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

Add simple scope management whenever a context is attached

Open sl0thentr0py opened this issue 1 year ago • 1 comments

  • create a new otel context _SCOPES_KEY that will hold a tuple of (curent_scope, isolation_scope)
  • the current_scope will always be forked (like on every span creation/context update in practice)
    • note that this is on attach, so not on all copy-on-write context object creation but only on apis such as trace.use_span or tracer.start_as_current_span
    • basically every otel context fork corresponds to our current_scope fork
  • the isolation_scope currently will not be forked
    • these will later be updated, for instance when we update our top level scope apis that fork isolation scope, that will also have a corresponding change in this attach function

sl0thentr0py avatar Jun 12 '24 12:06 sl0thentr0py

Codecov Report

Attention: Patch coverage is 27.27273% with 8 lines in your changes missing coverage. Please review.

Project coverage is 79.27%. Comparing base (4f9257d) to head (436626b).

Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #3159      +/-   ##
==============================================
- Coverage       79.30%   79.27%   -0.04%     
==============================================
  Files             134      134              
  Lines           14248    14255       +7     
  Branches         2989     2990       +1     
==============================================
  Hits            11300    11300              
- Misses           2101     2107       +6     
- Partials          847      848       +1     
Files Coverage Δ
.../integrations/opentelemetry/contextvars_context.py 42.85% <27.27%> (-28.58%) :arrow_down:

... and 1 file with indirect coverage changes

codecov[bot] avatar Jun 27 '24 17:06 codecov[bot]