diff --git a/setup.py b/setup.py index 4d8e2b883c..123d93e2e0 100644 --- a/setup.py +++ b/setup.py @@ -131,6 +131,11 @@ def get_file_text(file_name): "starlite": ["starlite>=1.48"], "tornado": ["tornado>=6"], }, + entry_points={ + "opentelemetry_propagator": [ + "sentry=sentry_sdk.integrations.opentelemetry:SentryPropagator" + ] + }, classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", diff --git a/tests/integrations/opentelemetry/test_entry_points.py b/tests/integrations/opentelemetry/test_entry_points.py new file mode 100644 index 0000000000..cd78209432 --- /dev/null +++ b/tests/integrations/opentelemetry/test_entry_points.py @@ -0,0 +1,17 @@ +import importlib +import os +from unittest.mock import patch + +from opentelemetry import propagate +from sentry_sdk.integrations.opentelemetry import SentryPropagator + + +def test_propagator_loaded_if_mentioned_in_environment_variable(): + try: + with patch.dict(os.environ, {"OTEL_PROPAGATORS": "sentry"}): + importlib.reload(propagate) + + assert len(propagate.propagators) == 1 + assert isinstance(propagate.propagators[0], SentryPropagator) + finally: + importlib.reload(propagate)