sentry-python
sentry-python copied to clipboard
POtel implementation base branch
Full state of CI: https://github.com/getsentry/sentry-python/pull/3744
Contains:
- https://github.com/getsentry/sentry-python/pull/4523
- https://github.com/getsentry/sentry-python/pull/4460
- https://github.com/getsentry/sentry-python/pull/4447
- https://github.com/getsentry/sentry-python/pull/4439
- https://github.com/getsentry/sentry-python/pull/4440
- https://github.com/getsentry/sentry-python/pull/4420
- https://github.com/getsentry/sentry-python/pull/4376
- https://github.com/getsentry/sentry-python/pull/4368
- https://github.com/getsentry/sentry-python/pull/4360
- https://github.com/getsentry/sentry-python/pull/4334
- https://github.com/getsentry/sentry-python/pull/4356
- https://github.com/getsentry/sentry-python/pull/4355
- https://github.com/getsentry/sentry-python/pull/4353
- https://github.com/getsentry/sentry-python/pull/4335
- https://github.com/getsentry/sentry-python/pull/4331
- https://github.com/getsentry/sentry-python/pull/4333
- https://github.com/getsentry/sentry-python/pull/4312
- https://github.com/getsentry/sentry-python/pull/4310
- https://github.com/getsentry/sentry-python/pull/4274
- https://github.com/getsentry/sentry-python/pull/4273
- https://github.com/getsentry/sentry-python/pull/4322
- https://github.com/getsentry/sentry-python/pull/4307
- https://github.com/getsentry/sentry-python/pull/4300
- https://github.com/getsentry/sentry-python/pull/4277
- https://github.com/getsentry/sentry-python/pull/4276
- https://github.com/getsentry/sentry-python/pull/4272
- https://github.com/getsentry/sentry-python/pull/4271
- https://github.com/getsentry/sentry-python/pull/4260
- https://github.com/getsentry/sentry-python/pull/4259
- https://github.com/getsentry/sentry-python/pull/4258
- https://github.com/getsentry/sentry-python/pull/3994
- https://github.com/getsentry/sentry-python/pull/4201
- https://github.com/getsentry/sentry-python/pull/4261
- https://github.com/getsentry/sentry-python/pull/4240
- https://github.com/getsentry/sentry-python/pull/4193
- https://github.com/getsentry/sentry-python/pull/4246
- https://github.com/getsentry/sentry-python/pull/4217
- https://github.com/getsentry/sentry-python/pull/4098
- https://github.com/getsentry/sentry-python/pull/4211
- https://github.com/getsentry/sentry-python/pull/4106
- https://github.com/getsentry/sentry-python/pull/4206
- https://github.com/getsentry/sentry-python/pull/4205
- https://github.com/getsentry/sentry-python/pull/4199
- https://github.com/getsentry/sentry-python/pull/4180
- https://github.com/getsentry/sentry-python/pull/4176
- https://github.com/getsentry/sentry-python/pull/4164
- https://github.com/getsentry/sentry-python/pull/4170
- https://github.com/getsentry/sentry-python/pull/4169
- https://github.com/getsentry/sentry-python/pull/4092
- https://github.com/getsentry/sentry-python/pull/4069
- https://github.com/getsentry/sentry-python/pull/4104
- https://github.com/getsentry/sentry-python/pull/4090
- https://github.com/getsentry/sentry-python/pull/4094
- https://github.com/getsentry/sentry-python/pull/4061
- https://github.com/getsentry/sentry-python/pull/3986
- https://github.com/getsentry/sentry-python/pull/3985
- https://github.com/getsentry/sentry-python/pull/3970
- https://github.com/getsentry/sentry-python/pull/3983
- https://github.com/getsentry/sentry-python/pull/3966
- https://github.com/getsentry/sentry-python/pull/3772
- https://github.com/getsentry/sentry-python/pull/3879
- https://github.com/getsentry/sentry-python/pull/3921
- https://github.com/getsentry/sentry-python/pull/3916
- https://github.com/getsentry/sentry-python/pull/3884
- https://github.com/getsentry/sentry-python/pull/3738
- https://github.com/getsentry/sentry-python/pull/3881
- https://github.com/getsentry/sentry-python/pull/3880
- https://github.com/getsentry/sentry-python/pull/3877
- https://github.com/getsentry/sentry-python/pull/3875
- https://github.com/getsentry/sentry-python/pull/3874
- https://github.com/getsentry/sentry-python/pull/3873
- https://github.com/getsentry/sentry-python/pull/3847
- https://github.com/getsentry/sentry-python/pull/3850
- https://github.com/getsentry/sentry-python/pull/3851
- https://github.com/getsentry/sentry-python/pull/3843
- https://github.com/getsentry/sentry-python/pull/3844
- https://github.com/getsentry/sentry-python/pull/3839
- https://github.com/getsentry/sentry-python/pull/3841
- https://github.com/getsentry/sentry-python/pull/3840
- https://github.com/getsentry/sentry-python/pull/3837
- https://github.com/getsentry/sentry-python/pull/3828
- https://github.com/getsentry/sentry-python/pull/3818
- https://github.com/getsentry/sentry-python/pull/3820
- https://github.com/getsentry/sentry-python/pull/3817
- https://github.com/getsentry/sentry-python/pull/3819
- https://github.com/getsentry/sentry-python/pull/3816
- https://github.com/getsentry/sentry-python/pull/3814
- https://github.com/getsentry/sentry-python/pull/3813
- https://github.com/getsentry/sentry-python/pull/3811
- https://github.com/getsentry/sentry-python/pull/3810
- https://github.com/getsentry/sentry-python/pull/3786
- https://github.com/getsentry/sentry-python/pull/3687
- https://github.com/getsentry/sentry-python/pull/3809
- https://github.com/getsentry/sentry-python/pull/3802
- https://github.com/getsentry/sentry-python/pull/3801
- https://github.com/getsentry/sentry-python/pull/3799
- https://github.com/getsentry/sentry-python/pull/3788
- https://github.com/getsentry/sentry-python/pull/3789
- https://github.com/getsentry/sentry-python/pull/3790
- https://github.com/getsentry/sentry-python/pull/3787
- https://github.com/getsentry/sentry-python/pull/3783
- https://github.com/getsentry/sentry-python/pull/3784
- https://github.com/getsentry/sentry-python/pull/3782
- https://github.com/getsentry/sentry-python/pull/3775
- https://github.com/getsentry/sentry-python/pull/3779
- https://github.com/getsentry/sentry-python/pull/3777
- https://github.com/getsentry/sentry-python/pull/3774
- https://github.com/getsentry/sentry-python/pull/3764
- https://github.com/getsentry/sentry-python/pull/3767
- https://github.com/getsentry/sentry-python/pull/3771
- https://github.com/getsentry/sentry-python/pull/3747
- https://github.com/getsentry/sentry-python/pull/3749
- https://github.com/getsentry/sentry-python/pull/3748
- https://github.com/getsentry/sentry-python/pull/3737
- https://github.com/getsentry/sentry-python/pull/3734
- https://github.com/getsentry/sentry-python/pull/3731
- https://github.com/getsentry/sentry-python/pull/3732
- https://github.com/getsentry/sentry-python/pull/3686
- https://github.com/getsentry/sentry-python/pull/3705
- https://github.com/getsentry/sentry-python/pull/3704
- https://github.com/getsentry/sentry-python/pull/3702
- https://github.com/getsentry/sentry-python/pull/3688
- https://github.com/getsentry/sentry-python/pull/3685
- https://github.com/getsentry/sentry-python/pull/3602
- https://github.com/getsentry/sentry-python/pull/3680
- https://github.com/getsentry/sentry-python/pull/3677
- https://github.com/getsentry/sentry-python/pull/3676
- https://github.com/getsentry/sentry-python/pull/3637
- https://github.com/getsentry/sentry-python/pull/3668
- https://github.com/getsentry/sentry-python/pull/3659
- https://github.com/getsentry/sentry-python/pull/3639
- https://github.com/getsentry/sentry-python/pull/3643
- https://github.com/getsentry/sentry-python/pull/3645
- https://github.com/getsentry/sentry-python/pull/3638
- https://github.com/getsentry/sentry-python/pull/3640
- https://github.com/getsentry/sentry-python/pull/3642
- https://github.com/getsentry/sentry-python/pull/3630
- https://github.com/getsentry/sentry-python/pull/3628
- https://github.com/getsentry/sentry-python/pull/3599
- https://github.com/getsentry/sentry-python/pull/3586
- https://github.com/getsentry/sentry-python/pull/3566
- https://github.com/getsentry/sentry-python/pull/3559
- https://github.com/getsentry/sentry-python/pull/3519
- https://github.com/getsentry/sentry-python/pull/3522
- https://github.com/getsentry/sentry-python/pull/3523
- https://github.com/getsentry/sentry-python/pull/3518
- https://github.com/getsentry/sentry-python/pull/3517
- https://github.com/getsentry/sentry-python/pull/3501
- https://github.com/getsentry/sentry-python/pull/3513
- https://github.com/getsentry/sentry-python/pull/3492
- https://github.com/getsentry/sentry-python/pull/3500
- https://github.com/getsentry/sentry-python/pull/3499
- https://github.com/getsentry/sentry-python/pull/3486
- https://github.com/getsentry/sentry-python/pull/3485
- https://github.com/getsentry/sentry-python/pull/3475
- https://github.com/getsentry/sentry-python/pull/3474
- https://github.com/getsentry/sentry-python/pull/3472
- https://github.com/getsentry/sentry-python/pull/3471
- https://github.com/getsentry/sentry-python/pull/3470
- https://github.com/getsentry/sentry-python/pull/3468
- https://github.com/getsentry/sentry-python/pull/3460
- https://github.com/getsentry/sentry-python/pull/3448
- https://github.com/getsentry/sentry-python/pull/3445
- https://github.com/getsentry/sentry-python/pull/3441
- https://github.com/getsentry/sentry-python/pull/3442
- https://github.com/getsentry/sentry-python/pull/3436
- https://github.com/getsentry/sentry-python/pull/3437
- https://github.com/getsentry/sentry-python/pull/3432
- https://github.com/getsentry/sentry-python/pull/3431
- https://github.com/getsentry/sentry-python/pull/3389
- https://github.com/getsentry/sentry-python/pull/3379
- https://github.com/getsentry/sentry-python/pull/3297
- https://github.com/getsentry/sentry-python/pull/3286
- https://github.com/getsentry/sentry-python/pull/3242
- https://github.com/getsentry/sentry-python/pull/3446
- https://github.com/getsentry/sentry-python/pull/3223
- https://github.com/getsentry/sentry-python/pull/3159
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()
Codecov Report
:x: Patch coverage is 90.44970% with 206 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 84.85%. Comparing base (57a3405) to head (bdca31d).
:warning: Report is 130 commits behind head on master.
:white_check_mark: All tests successful. No failed tests found.
Additional details and impacted files
@@ Coverage Diff @@
## master #3152 +/- ##
==========================================
- Coverage 84.85% 84.85% -0.01%
==========================================
Files 156 158 +2
Lines 16110 16093 -17
Branches 2740 2564 -176
==========================================
- Hits 13670 13655 -15
+ Misses 1651 1648 -3
- Partials 789 790 +1
| Files with missing lines | Coverage Δ | |
|---|---|---|
| sentry_sdk/__init__.py | 100.00% <100.00%> (ø) |
|
| sentry_sdk/_init_implementation.py | 100.00% <100.00%> (+4.16%) |
:arrow_up: |
| sentry_sdk/_log_batcher.py | 79.76% <100.00%> (+0.24%) |
:arrow_up: |
| sentry_sdk/_lru_cache.py | 100.00% <100.00%> (ø) |
|
| sentry_sdk/_queue.py | 62.22% <100.00%> (+2.22%) |
:arrow_up: |
| sentry_sdk/_werkzeug.py | 50.00% <100.00%> (+1.85%) |
:arrow_up: |
| sentry_sdk/ai/utils.py | 86.95% <100.00%> (+0.59%) |
:arrow_up: |
| sentry_sdk/attachments.py | 100.00% <100.00%> (ø) |
|
| sentry_sdk/crons/api.py | 100.00% <100.00%> (ø) |
|
| sentry_sdk/crons/decorator.py | 100.00% <100.00%> (ø) |
|
| ... and 140 more |