Skip to content

Commit 407f651

Browse files
mendersl0thentr0py
andauthored
feat(opentelemetry): Add entry point for SentryPropagator (#3086)
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 #3085 Co-authored-by: Neel Shah <[email protected]>
1 parent eab218c commit 407f651

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
@@ -131,6 +131,11 @@ def get_file_text(file_name):
131131
"starlite": ["starlite>=1.48"],
132132
"tornado": ["tornado>=6"],
133133
},
134+
entry_points={
135+
"opentelemetry_propagator": [
136+
"sentry=sentry_sdk.integrations.opentelemetry:SentryPropagator"
137+
]
138+
},
134139
classifiers=[
135140
"Development Status :: 5 - Production/Stable",
136141
"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)