Skip to content

Support for opentelemetry-api 1.13.0 #5315

Closed
@cpiment

Description

@cpiment

Summary

When trying to use the opentelemetry callback with opentelemetry 1.13 this warning arises:

[WARNING]: Skipping callback 'community.general.opentelemetry', unable to load due to: The `opentelemetry-api`, `opentelemetry-exporter-otlp` or `opentelemetry-sdk` must be installed to use this plugin

I have debugged the error and it raises when it reaches this line:
https://github.com/ansible-collections/community.general/blob/main/plugins/callback/opentelemetry.py#L113

opentelemetry.util._time has been removed in this commit from OpenTelemetry: open-telemetry/opentelemetry-python@a6324d8

I have modified the offending line with this and it works:

from time import time_ns as _time_ns

Issue Type

Bug Report

Component Name

community.general.opentelemetry

Ansible Version

$ ansible --version
ansible [core 2.12.2]
  config file = /var/opt/ansible/ansible.cfg
  configured module search path = ['/apps/users/***/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = /apps/users/***/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 2.10.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 4.5.0

# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
community.general 5.6.0

Configuration

$ ansible-config dump --only-changed
CALLBACKS_ENABLED(/var/opt/ansible/ansible.cfg) = ['community.general.opentelemetry']
DEFAULT_FORKS(/var/opt/ansible/ansible.cfg) = 20
DEFAULT_LOG_PATH(/var/opt/ansible/ansible.cfg) = /var/opt/ansible/log/ansible.log
DEFAULT_ROLES_PATH(/var/opt/ansible/ansible.cfg) = ['/apps/users/***/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles', '/var/opt/ansible/roles']
DEFAULT_VAULT_PASSWORD_FILE(/var/opt/ansible/ansible.cfg) = /var/opt/ansible/password_file

OS / Environment

RHEL 8.6

Steps to Reproduce

Install opentelemetry-api, opentelemetry-sdk and opentelemetry-exporter-otlp in version 1.13 and try to run any playbook with -vvvv

Expected Results

No warnings and Opentelemetry callback working

Actual Results

[WARNING]: Skipping callback 'community.general.opentelemetry', unable to load due to: The `opentelemetry-api`, `opentelemetry-exporter-otlp` or `opentelemetry-sdk` must be installed to use this plugin

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugcallbackcallback pluginhas_prpluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions