blueswen / fastapi-jaeger

Trace FastAPI with Jaeger through OpenTelemetry Python API and SDK.
81 stars 21 forks source link

Getting "Overriding of current TracerProvider is not allowed" error #8

Closed jxc517 closed 6 months ago

jxc517 commented 7 months ago

Overriding of current TracerProvider is not allowed.

Traceback (most recent call last):
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/app/main.py", line 173, in <module>
    setting_otel(app)
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/app/main.py", line 164, in setting_otel
    tracer.add_span_processor(BatchSpanProcessor(OTLPSpanExporterHTTP(endpoint=OTLP_DYNATRACE_ENDPOINT, headers=OTEL_EXPORTER_OTLP_HEADERS)))
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaydeepcheruku/git-repos/mfgot-asset-services/assets-api/venv/lib/python3.12/site-packages/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 96, in __init__
    self._session.headers.update(self._headers)
  File "<frozen _collections_abc>", line 987, in update
ValueError: not enough values to unpack (expected 2, got 1)
blueswen commented 6 months ago

Looks like you are not using code from this repository. Could you provide all of your code and the opentelemetry package version you are using?

jxc517 commented 6 months ago

I was able to make my version of code work, all good and thanks for reaching out.