Skip to content

Fail to load v1.13.0 due to module not found error in Python v3.12 #554

@a03nikki

Description

@a03nikki

Describe the bug

elastic-opentelemetry 1.13.0 fails to load its distro at startup with ModuleNotFoundError: No module named 'opentelemetry._opamp.agent'. The contradiction is that 1.13.0 hard-pins opentelemetry-sdk==1.41.1 as a dependency, but imports a private internal module (opentelemetry._opamp.agent) that does not exist in opentelemetry-sdk 1.41.1. The distro fails entirely, leaving the application with no OTel instrumentation.

Downgrading to elastic-opentelemetry==1.11.0 resolves the issue.

To Reproduce

  1. Create a Python 3.12 virtual environment and install elastic-opentelemetry==1.13.0 (e.g. via pip install elastic-opentelemetry==1.13.0)
  2. Confirm opentelemetry-sdk==1.41.1 and opentelemetry-opamp-client==0.2b0 are installed as transitive dependencies
  3. Run any application with opentelemetry-instrument python -m uvicorn myapp:app ... (or any WSGI/ASGI equivalent)
  4. Observe startup error:
Distribution distro configuration failed
Traceback (most recent call last):
  File ".../opentelemetry/instrumentation/auto_instrumentation/_load.py", line 68, in _load_distro
    distro = entry_point.load()()
  File ".../elasticotel/distro/__init__.py", line 55, in <module>
    from opentelemetry._opamp.agent import OpAMPAgent
ModuleNotFoundError: No module named 'opentelemetry._opamp.agent'
Failed to auto initialize OpenTelemetry

Environment (please complete the following information)

  • OS: macOS (Darwin 25.5.0, Apple Silicon)
  • Python version: 3.12.13
  • Framework and version: FastAPI 0.115.x + uvicorn 0.30.x
  • Distro version: elastic-opentelemetry 1.13.0

Additional context

The opentelemetry-opamp-client package (0.2b0) is installed — it is correctly listed as a dependency of elastic-opentelemetry 1.13.0 and resolves — but the failing import is opentelemetry._opamp.agent, which is a private internal module of opentelemetry-sdk (underscore-prefixed), not the public opentelemetry.opamp namespace provided by opentelemetry-opamp-client. These are two different things.

The package's own pinned SDK version (opentelemetry-sdk==1.41.1) does not contain opentelemetry._opamp, making this a self-contradictory release: the distro cannot load against the exact SDK version it requires.

Workaround: Pin to elastic-opentelemetry==1.11.0, which does not have this import and works correctly with the same application and Python version.

  • Distro or OpenTelemetry config options

    Click to expand
    OTEL_EXPORTER_OTLP_ENDPOINT=https://<redacted>.ingest.us-central1.gcp.elastic-cloud.com:443
    OTEL_EXPORTER_OTLP_HEADERS=Authorization=ApiKey <redacted>
    OTEL_SERVICE_NAME=<redacted>
    OTEL_RESOURCE_ATTRIBUTES=deployment.environment=staging,service.version=1.1.0
    OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
    
  • requirements.txt:

    Click to expand
    elastic-opentelemetry==1.13.0   # broken; 1.11.0 is the workaround
    

    Installed transitive versions confirmed via pip show:

    • opentelemetry-sdk: 1.41.1
    • opentelemetry-api: 1.41.1
    • opentelemetry-opamp-client: 0.2b0
    • opentelemetry-semantic-conventions: 0.62b1

Description written by Claude and reviewed by Nikki.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions