community.general.opentelemetry (8.5.0) — callback

Create distributed traces with OpenTelemetry

| "added in version" 3.7.0 of community.general"

Authors: Victor Martinez (@v1v) <VictorMartinezRubio@gmail.com>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This callback creates distributed traces for each Ansible task with OpenTelemetry.

You can configure the OpenTelemetry exporter and SDK with environment variables.

See U(https://opentelemetry-python.readthedocs.io/en/latest/exporter/otlp/otlp.html).

See U(https://opentelemetry-python.readthedocs.io/en/latest/sdk/environment_variables.html#opentelemetry-sdk-environment-variables).


Requirements

Inputs

    
traceparent:
    default: None
    description:
    - The L(W3C Trace Context header traceparent,https://www.w3.org/TR/trace-context-1/#traceparent-header).
    env:
    - name: TRACEPARENT
    type: str

disable_logs:
    default: false
    description:
    - Disable sending logs.
    env:
    - name: ANSIBLE_OPENTELEMETRY_DISABLE_LOGS
    ini:
    - key: disable_logs
      section: callback_opentelemetry
    type: bool
    version_added: 5.8.0
    version_added_collection: community.general

otel_service_name:
    default: ansible
    description:
    - The service name resource attribute.
    env:
    - name: OTEL_SERVICE_NAME
    ini:
    - key: otel_service_name
      section: callback_opentelemetry
      version_added: 5.3.0
      version_added_collection: community.general
    type: str

hide_task_arguments:
    default: false
    description:
    - Hide the arguments for a task.
    env:
    - name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
    ini:
    - key: hide_task_arguments
      section: callback_opentelemetry
      version_added: 5.3.0
      version_added_collection: community.general
    type: bool

enable_from_environment:
    description:
    - Whether to enable this callback only if the given environment variable exists and
      it is set to V(true).
    - This is handy when you use Configuration as Code and want to send distributed traces
      if running in the CI rather when running Ansible locally.
    - For such, it evaluates the given O(enable_from_environment) value as environment
      variable and if set to true this plugin will be enabled.
    env:
    - name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
    ini:
    - key: enable_from_environment
      section: callback_opentelemetry
      version_added: 5.3.0
      version_added_collection: community.general
    type: str
    version_added: 3.8.0
    version_added_collection: community.general

disable_attributes_in_logs:
    default: false
    description:
    - Disable populating span attributes to the logs.
    env:
    - name: ANSIBLE_OPENTELEMETRY_DISABLE_ATTRIBUTES_IN_LOGS
    ini:
    - key: disable_attributes_in_logs
      section: callback_opentelemetry
    type: bool
    version_added: 7.1.0
    version_added_collection: community.general