community.general.opentelemetry (3.8.10) — 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:==3.8.10


Add to requirements.yml

  collections:
    - name: community.general
      version: 3.8.10

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

otel_service_name:
    default: ansible
    description:
    - The service name resource attribute.
    env:
    - name: OTEL_SERVICE_NAME
    type: str

hide_task_arguments:
    default: false
    description:
    - Hide the arguments for a task.
    env:
    - name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
    type: bool

enable_from_environment:
    description:
    - Whether to enable this callback only if the given environment variable exists and
      it is set to C(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 I(enable_from_environment) value as environment
      variable and if set to true this plugin will be enabled.
    env:
    - name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
    type: str
    version_added: 3.8.0
    version_added_collection: community.general