sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Dual POTel setup improvements

Open sentrivana opened this issue 7 months ago • 1 comments

  • If a TracerProvider already exists, patch it. TracerProvider is a singleton, so if we aren't the first ones setting it up, we need to use the existing one.
    • In tests, reset TracerProvider after each test so that we start with a clean slate and it gets set up anew on init.
  • If an OTel span starts, record its instrumentation_scope.name (e.g. opentelemetry.instrumentation.flask) and turn it into origin at the end. This allows us to differentiate between spans auto-instrumented by Sentry and OTel.

sentrivana avatar May 19 '25 12:05 sentrivana

Codecov Report

:x: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 84.85%. Comparing base (f5fb6e7) to head (8c7c46a). :warning: Report is 215 commits behind head on potel-base.

Files with missing lines Patch % Lines
sentry_sdk/opentelemetry/span_processor.py 75.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4401      +/-   ##
==============================================
+ Coverage       84.80%   84.85%   +0.05%     
==============================================
  Files             144      144              
  Lines           14728    14740      +12     
  Branches         2343     2345       +2     
==============================================
+ Hits            12490    12508      +18     
+ Misses           1523     1515       -8     
- Partials          715      717       +2     
Files with missing lines Coverage Δ
sentry_sdk/opentelemetry/tracing.py 100.00% <100.00%> (ø)
sentry_sdk/tracing.py 79.64% <ø> (-0.71%) :arrow_down:
sentry_sdk/opentelemetry/span_processor.py 82.55% <75.00%> (+0.41%) :arrow_up:

... and 4 files with indirect coverage changes

codecov[bot] avatar May 19 '25 12:05 codecov[bot]