Skip to content

DeprecationWarning with opentelemetry-python api + sdk both at 1.11.1 #2831

@thisfred

Description

@thisfred

When calling TracerProvicer.get_tracer(), I see a deprecationwarning even though both libraries are at the same version.

The issue seems to be that the sdk instantiates an InstrumentationInfo object here:

https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L1162-L1166

which seems to be deprecated here:

@deprecated(version="1.11.1", reason="You should use InstrumentationScope")
def __init__(
self,
name: str,
version: Optional[str] = None,
schema_url: Optional[str] = None,
):
self._name = name
self._version = version
if schema_url is None:
schema_url = ""
self._schema_url = schema_url

Unless I'm misreading the coce, this means there is no way to get rid of this deprecation warning, because the library deprecated something but continues to use it, which seems unusual.

environment:

python 3.7.10

(relevant part of) requirements.txt

opentelemetry-api==1.11.1
opentelemetry-exporter-otlp-proto-grpc==1.11.1
opentelemetry-instrumentation==0.30b1
opentelemetry-instrumentation-asgi==0.30b1
opentelemetry-instrumentation-flask==0.30b1
opentelemetry-instrumentation-pymongo==0.30b1
opentelemetry-instrumentation-requests==0.30b1
opentelemetry-instrumentation-sqlalchemy==0.30b1
opentelemetry-instrumentation-wsgi==0.30b1
opentelemetry-proto==1.11.1
opentelemetry-sdk==1.11.1
opentelemetry-semantic-conventions==0.30b1
opentelemetry-util-http==0.30b1

Steps to reproduce:

We're seeing it when doing something like:

from [our own central lbrary that re-exports some opentelemetry functions] import get_tracer
tracer = get_tracer(__name__)

with tracer.start_as_current_span(name=span_name, kind=SpanKind.CLIENT):
    [make a request to an external service] 

The only things that I can think of that are slightly unusual here is that we're importing get_tracer from a different place, and that we're starting a CLIENT span.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions