sentry-python
sentry-python copied to clipboard
POtel implementation base branch
Contains:
- https://github.com/getsentry/sentry-python/pull/3159
- https://github.com/getsentry/sentry-python/pull/3223
- https://github.com/getsentry/sentry-python/pull/3446
- https://github.com/getsentry/sentry-python/pull/3242
- https://github.com/getsentry/sentry-python/pull/3286
- https://github.com/getsentry/sentry-python/pull/3297
- https://github.com/getsentry/sentry-python/pull/3379
- https://github.com/getsentry/sentry-python/pull/3389
- https://github.com/getsentry/sentry-python/pull/3431
- https://github.com/getsentry/sentry-python/pull/3432
- https://github.com/getsentry/sentry-python/pull/3437
- https://github.com/getsentry/sentry-python/pull/3436
- https://github.com/getsentry/sentry-python/pull/3442
- https://github.com/getsentry/sentry-python/pull/3441
- https://github.com/getsentry/sentry-python/pull/3445
- https://github.com/getsentry/sentry-python/pull/3448
- https://github.com/getsentry/sentry-python/pull/3460
- https://github.com/getsentry/sentry-python/pull/3468
- https://github.com/getsentry/sentry-python/pull/3470
- https://github.com/getsentry/sentry-python/pull/3471
- https://github.com/getsentry/sentry-python/pull/3472
- https://github.com/getsentry/sentry-python/pull/3474
- https://github.com/getsentry/sentry-python/pull/3475
- https://github.com/getsentry/sentry-python/pull/3485
- https://github.com/getsentry/sentry-python/pull/3486
- https://github.com/getsentry/sentry-python/pull/3499
- https://github.com/getsentry/sentry-python/pull/3500
- https://github.com/getsentry/sentry-python/pull/3492
- https://github.com/getsentry/sentry-python/pull/3513
- https://github.com/getsentry/sentry-python/pull/3501
- https://github.com/getsentry/sentry-python/pull/3517
- https://github.com/getsentry/sentry-python/pull/3518
- https://github.com/getsentry/sentry-python/pull/3523
- https://github.com/getsentry/sentry-python/pull/3522
- https://github.com/getsentry/sentry-python/pull/3519
- https://github.com/getsentry/sentry-python/pull/3559
- https://github.com/getsentry/sentry-python/pull/3566
- https://github.com/getsentry/sentry-python/pull/3586
- https://github.com/getsentry/sentry-python/pull/3599
- https://github.com/getsentry/sentry-python/pull/3628
- https://github.com/getsentry/sentry-python/pull/3630
- https://github.com/getsentry/sentry-python/pull/3642
- https://github.com/getsentry/sentry-python/pull/3640
- https://github.com/getsentry/sentry-python/pull/3638
- https://github.com/getsentry/sentry-python/pull/3645
- https://github.com/getsentry/sentry-python/pull/3643
- https://github.com/getsentry/sentry-python/pull/3639
- https://github.com/getsentry/sentry-python/pull/3659
- https://github.com/getsentry/sentry-python/pull/3668
- https://github.com/getsentry/sentry-python/pull/3637
- https://github.com/getsentry/sentry-python/pull/3676
- https://github.com/getsentry/sentry-python/pull/3677
- https://github.com/getsentry/sentry-python/pull/3680
- https://github.com/getsentry/sentry-python/pull/3602
- https://github.com/getsentry/sentry-python/pull/3685
Simple test
import sentry_sdk
from time import sleep
sentry_sdk.init(
debug=True,
traces_sample_rate=1.0,
_experiments={"otel_powered_performance": True},
)
with sentry_sdk.start_span(description="sentry request"):
sleep(0.1)
with sentry_sdk.start_span(description="sentry db"):
sleep(0.5)
with sentry_sdk.start_span(description="sentry redis"):
sleep(0.2)
with sentry_sdk.start_span(description="sentry http"):
sleep(1)
References
-
JS
startSpan
& friends -
OTel
start_span
& friends - JS new performance API readme
Misc
In OTel, this:
with tracer.start_as_current_span("parent") as parent:
with tracer.start_span("child1"):
pass
with tracer.start_span("child2"):
pass
is equivalent to
from opentelemetry import trace, context
parent = tracer.start_span("parent")
# Creates a Context object with parent set as current span
ctx = trace.set_span_in_context(parent)
# Set as the implicit current context
token = context.attach(ctx)
# Child will automatically be a child of parent
child1 = tracer.start_span("child1")
child1.end()
# Child will automatically be a child of parent
child2 = tracer.start_span("child2")
child2.end()
# Don't forget to detach or parent will remain the parent above this call stack
context.detach(token)
parent.end()