chore(sentry): disable Django middleware span auto-instrumentation#155
Merged
thomasrockhu-codecov merged 1 commit intoMay 20, 2026
Merged
Conversation
Sets `middleware_spans=False` on the `DjangoIntegration` passed to `sentry_sdk.init`. Per-middleware spans (`span.op:middleware.django`) don't carry middleware-specific debugging information — only the middleware FQN and a duration that is bounded by the chain below it rather than reflecting the middleware's own cost. No headers, no auth context, no signal that isn't already on the request envelope or on the ORM / HTTP child spans. Dropping them reduces SDK overhead with no observability regression.
c2ca99f to
c00a27e
Compare
jason-ford-codecov
approved these changes
May 20, 2026
calvin-codecov
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
middleware_spans=FalsetoDjangoIntegrationincodecov_slack_app/settings.pyso per-middleware spans stop being auto-emitted.Why
Auto-instrumented
middleware.djangospans don't carry useful debugging information. Amiddleware.djangospan carries onlyspan.description(the FQN of the middleware method) andspan.duration— no middleware-specific attributes, no headers, no auth context. Because Django middleware wrapsget_response, the__call__duration is bounded by the chain below it and clusters at the request-envelope value, so individual middleware spans rarely identify a real bottleneck.Everything debuggable (the request envelope, ORM queries, outbound HTTP via HttpxIntegration, view rendering) is on its own span and is not affected by this change.
If a specific custom middleware ever needs targeted timing, we can manually wrap it with
sentry_sdk.start_span(op="middleware.codecov", description="…").Test plan
span.op:middleware.djangocount drops to ~0 for the slack-app projectRefs