-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <neel.shah@sentry.io>
- Loading branch information
1 parent
eab218c
commit 407f651
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |