MCPcopy Create free account
hub / github.com/getsentry/sentry / ContextPropagatingThreadPoolExecutor

Class ContextPropagatingThreadPoolExecutor

src/sentry/utils/concurrent.py:243–254  ·  view source on GitHub ↗

A ThreadPoolExecutor that automatically copies the caller's ``contextvars.Context`` into each worker invocation. This ensures Sentry SDK scopes (isolation_scope, current_scope), OpenTelemetry trace context, and any other context variables are available in worker threads without manu

Source from the content-addressed store, hash-verified

241
242
243class ContextPropagatingThreadPoolExecutor(_ThreadPoolExecutor):
244 """A ThreadPoolExecutor that automatically copies the caller's
245 ``contextvars.Context`` into each worker invocation.
246
247 This ensures Sentry SDK scopes (isolation_scope, current_scope),
248 OpenTelemetry trace context, and any other context variables are
249 available in worker threads without manual propagation.
250 """
251
252 def submit(self, fn, /, *args, **kwargs):
253 ctx = contextvars.copy_context()
254 return super().submit(ctx.run, fn, *args, **kwargs)
255
256
257class FutureSet:

Callers 15

_bulk_snuba_queryFunction · 0.90
_make_rpc_requestsFunction · 0.90
delete_replay_recordingFunction · 0.90
iter_segment_dataFunction · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
_fetch_batch_imagesFunction · 0.90
_fetch_manifestsFunction · 0.90

Calls

no outgoing calls