opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

OTEL_PROPAGATORS does not support "none" value

Open M-Sayed opened this issue 6 months ago • 5 comments

Describe your environment

OS: Linux/amd64 Python version: Python 3.12 SDK version: I installed following libs using pip, so I assume the latest version (opentelemetry-exporter-otlp opentelemetry-instrumentation-requests opentelemetry-instrumentation-flask) API version: I installed following libs using pip, so I assume the latest version (opentelemetry-exporter-otlp opentelemetry-instrumentation-requests opentelemetry-instrumentation-flask)

What happened?

It seems that I can't disable context propagation in Python by setting the OTEL_PROPAGATORS ENV variable to none as mentioned here.

When trying to do so, I get the following error:

{
  "message": "Uncaught exception",
  "traceback": "Traceback (most recent call last):
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/propagate/__init__.py\", line 139, in <module>
      next(  # type: ignore
  StopIteration
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File \"/cert-issuer/wsgi.py\", line 1, in <module>
      from app import app
    File \"/cert-issuer/app.py\", line 24, in <module>
      setup_instrument(app)
    File \"/cert-issuer/accredible/setup_instrument.py\", line 24, in setup_instrument
      from opentelemetry.instrumentation.flask import FlaskInstrumentor
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/instrumentation/flask/__init__.py\", line 251, in <module>
      import opentelemetry.instrumentation.wsgi as otel_wsgi
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/instrumentation/wsgi/__init__.py\", line 216, in <module>
      from opentelemetry.instrumentation._semconv import (
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/instrumentation/_semconv.py\", line 19, in <module>
      from opentelemetry.instrumentation.utils import http_status_to_status_code
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/instrumentation/utils.py\", line 32, in <module>
      from opentelemetry.propagate import extract
    File \"/usr/local/lib/python3.12/site-packages/opentelemetry/propagate/__init__.py\", line 149, in <module>
      raise ValueError(
  ValueError: Propagator none not found. It is either misspelled or not installed."
}

It seems that error happens at this line and it's because we are missing the none propagator definition here in opentelemetry-api/pyproject.toml. (I am not a python expert, so my assumption can be wrong)

Steps to Reproduce

  • set OTEL_PROPAGATORS=none
  • run the app

Expected Result

No errors are expected, and automatic propagation is disabled.

Actual Result

Error that the none propagator is not defined.

Additional context

I am not sure if setting the OTEL_PROPAGATORS="" will be valid, but according to the documentation, none should be a valid value.

Would you like to implement a fix?

None

M-Sayed avatar Aug 22 '24 10:08 M-Sayed