File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
platform-includes/performance
platforms/common/performance/instrumentation Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1+ <Note >
2+
3+ Sentry requires ` opentelemetry-distro ` version ` 0.350b0 ` or higher.
4+
5+ </Note >
6+
7+ ``` bash
8+ pip install --upgrade ' sentry-sdk[opentelemetry]'
9+ ```
Original file line number Diff line number Diff line change 1+ Initialize Sentry for tracing and set the ` instrumenter ` to ` otel ` :
2+
3+ ``` python
4+ import sentry_sdk
5+
6+ sentry_sdk.init(
7+ dsn = " ___PUBLIC_DSN___" ,
8+ traces_sample_rate = 1.0 ,
9+ # set the instrumenter to use OpenTelemetry instead of Sentry
10+ instrumenter = " otel" ,
11+ )
12+ ```
13+
14+ This disables all Sentry instrumentation and relies on the chosen OpenTelemetry tracers for creating spans.
15+
16+ Next, configure OpenTelemetry as you need and hook in the Sentry span processor and propagator:
17+
18+ ``` python
19+ from opentelemetry import trace
20+ from opentelemetry.propagate import set_global_textmap
21+ from sentry_sdk.integrations.opentelemetry import SentrySpanProcessor, SentryPropagator
22+
23+ provider = trace.get_tracer_provider()
24+ provider.add_span_processor(SentrySpanProcessor())
25+ set_global_textmap(SentryPropagator())
26+ ```
Original file line number Diff line number Diff line change 22title : OpenTelemetry Support
33sidebar_order : 20
44supported :
5- - node
65 - javascript.nextjs
6+ - node
7+ - python
78 - ruby
89notSupported :
910 - javascript
10- - python
1111 - dart
1212 - flutter
1313 - react-native
You can’t perform that action at this time.
0 commit comments