Skip to content

Commit b2d7644

Browse files
committed
feat(opentelemetry): Add entry point for SentryPropagator
Add entry point for sentry_sdk.integrations.opentelemetry.SentryPropagator. This makes possible to configure opentelemetry using environment variables and add SentryPropagator to existing ones instead of replace them. Closes getsentry#3085
1 parent 84775a0 commit b2d7644

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

setup.py

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ def get_file_text(file_name):
8686
"starlite": ["starlite>=1.48"],
8787
"tornado": ["tornado>=5"],
8888
},
89+
entry_points={
90+
"opentelemetry_propagator": [
91+
"sentry=sentry_sdk.integrations.opentelemetry:SentryPropagator"
92+
]
93+
},
8994
classifiers=[
9095
"Development Status :: 5 - Production/Stable",
9196
"Environment :: Web Environment",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import importlib
2+
import os
3+
from unittest.mock import patch
4+
5+
from opentelemetry import propagate
6+
from sentry_sdk.integrations.opentelemetry import SentryPropagator
7+
8+
9+
def test_propagator_loaded_if_mentioned_in_environment_variable():
10+
try:
11+
with patch.dict(os.environ, {"OTEL_PROPAGATORS": "sentry"}):
12+
importlib.reload(propagate)
13+
14+
assert len(propagate.propagators) == 1
15+
assert isinstance(propagate.propagators[0], SentryPropagator)
16+
finally:
17+
importlib.reload(propagate)

0 commit comments

Comments
 (0)