Skip to content

Incorrect shim code example #5072

@WeatherGod

Description

@WeatherGod

The shim's create_shim() function takes a TracerProvider, not a Tracer object.

>>> shim = create_tracer(otel_tracer)
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    shim = create_tracer(otel_tracer)
  File "/home/benroot/miniconda3/envs/py13/lib/python3.13/site-packages/opentelemetry/shim/opentracing_shim/__init__.py", line 150, in create_tracer
    return TracerShim(otel_tracer_provider.get_tracer(__name__, __version__))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Tracer' object has no attribute 'get_tracer'

I've seen similar code examples elsewhere with this incorrect usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions