open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
705 stars 589 forks source link

Missing dependency to 'opentelemetry-semantic-conventions' #2862

Closed enrico-stauss closed 3 weeks ago

enrico-stauss commented 4 weeks ago

Describe your environment

OS: Windows 11 Python version: 3.10 Package version: 0.47.0

What happened?

I recently introduced deepeval into my dependencies which seems to have produced a version conflict on my system. I believe the root cause to be the missing dependency specification to 'opentelemetry-semantic-conventions' in 'opentelemetry-instrumentation>=0.47.0'. In this file: https://github.com/open-telemetry/opentelemetry-python-contrib/blob/6f1a17d8dd5d2f2f51cfe9d65e57cc8d16632154/opentelemetry-instrumentation/src/opentelemetry/instrumentation/_semconv.py#L20-L23

the import from opentelemetry-semantic-conventions will fail if opentelemetry-semantic-conventions<=0.45.0b0 (or 1.24.0 I belive) as the attributes module was introduced only later.

Steps to Reproduce

In a fresh python env run: pip install deepeval opentelemetry-instrumentation and you will get an env with

opentelemetry-api                         1.24.0
opentelemetry-exporter-otlp-proto-common  1.24.0
opentelemetry-exporter-otlp-proto-grpc    1.24.0
opentelemetry-instrumentation             0.48b0
opentelemetry-proto                       1.24.0
opentelemetry-sdk                         1.24.0
opentelemetry-semantic-conventions        0.45b0

which will break from opentelemetry.instrumentation.instrumentor import BaseInstrumentor due to the imports in _semconv from the attributes module as described above.

Expected Result

Fixing the dependency to the appropriate version to avoid version conflicts

Actual Result

ImportError

Additional context

No response

Would you like to implement a fix?

None

xrmx commented 4 weeks ago

Good catch, thanks for reporting.

shijiadong2022 commented 3 weeks ago

I'd like to work on this one and submit a PR soon