Skip to content

fix: TraceIgnoreStatusCodes no longer drops outgoing HTTP requests traced with OpenTelemetry - #5643

Merged
jamescrosswell merged 1 commit into
mainfrom
fix/trace-ignore-status-codes-server-only
Sep 30, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
fix/trace-ignore-status-codes-server-only

Conversation

@jamescrosswell

Copy link
Copy Markdown
Collaborator

Summary

TraceIgnoreStatusCodes now only filters http.server transactions. Until now it also dropped outgoing HttpClient calls traced with OpenTelemetry.

With OpenTelemetry, an HttpClient call that has no local parent (in a BackgroundService, a timer, startup code, or a consumer continuing a remote traceparent) becomes an http.client transaction of its own. SentrySpanProcessor.OnEnd copies http.response.status_code onto it, and TraceIgnoreStatusCodeTransactionProcessor then dropped it whenever the downstream status matched the list. For example, a 401 or 403 from a downstream API usually means expired credentials, and that transaction silently disappeared.

The spec says the option "applies exclusively to incoming requests". All of the SDK's incoming-request transactions use the http.server operation: the ASP.NET Core SentryTracingMiddleware, ASP.NET's HttpContextExtensions, and SentrySpanProcessor.ParseOtelSpanDescription for non-client HTTP spans. So the processor now checks the operation, as an allowlist rather than excluding http.client, so that other root transactions carrying a status code are left alone too.

Found by @ric-oliv while reviewing #5632, which turns on a non-empty default for TraceIgnoreStatusCodes in 7.0. That would expose this bug to every ASP.NET Core app using OpenTelemetry, so this fix needs to reach version7 before #5632 merges.

Notes for review

  • Until now this only affected people who configured TraceIgnoreStatusCodes themselves, since the list is empty by default on main.
  • Added ParseOtelSpanDescription_HttpServer alongside the existing http.client test, since the processor now depends on OpenTelemetry server spans being mapped to http.server.

🤖 Generated with Claude Code

…aced with OpenTelemetry

With OpenTelemetry, an HttpClient call with no local parent becomes an
http.client transaction carrying http.response.status_code, so the
processor dropped it. The spec scopes the option to incoming requests,
so only filter http.server transactions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.93%. Comparing base (4af9645) to head (54a97ac).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5643      +/-   ##
==========================================
+ Coverage   74.37%   74.93%   +0.56%     
==========================================
  Files         501      515      +14     
  Lines       18566    18973     +407     
  Branches     3603     3693      +90     
==========================================
+ Hits        13808    14217     +409     
+ Misses       3883     3876       -7     
- Partials      875      880       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell
jamescrosswell marked this pull request as ready for review September 30, 2026 00:48
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 30, 2026

@ric-oliv ric-oliv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jamescrosswell
jamescrosswell merged commit 70909e9 into main Sep 30, 2026
52 checks passed
@jamescrosswell
jamescrosswell deleted the fix/trace-ignore-status-codes-server-only branch September 30, 2026 21:27
jonty-uk-gov-mirror pushed a commit to uk-gov-mirror/DFE-Digital.teaching-record-system that referenced this pull request Oct 23, 2026
Updated [Sentry.AspNetCore](https://github.com/getsentry/sentry-dotnet)
from 6.11.1 to 6.12.0.

<details>
<summary>Release notes</summary>

_Sourced from [Sentry.AspNetCore's
releases](https://github.com/getsentry/sentry-dotnet/releases)._

## 6.12.0

### Features ✨

- feat(otel): mark span processor based OpenTelemetry setup methods as
obsolete by @​jamescrosswell in
[#​5586](getsentry/sentry-dotnet#5586)

### Fixes 🐛

- fix(blazor): logging options set in UseSentry now take effect by
@​ric-oliv in
[#​5640](getsentry/sentry-dotnet#5640)
- fix(log4net): send event properties as log attributes on log4net 3.x
by @​jamescrosswell in
[#​5559](getsentry/sentry-dotnet#5559)
- fix: TraceIgnoreStatusCodes no longer drops outgoing HTTP requests
traced with OpenTelemetry by @​jamescrosswell in
[#​5643](getsentry/sentry-dotnet#5643)
- fix: an exception in BeforeSend or BeforeSendTransaction now drops the
item instead of sending it by @​jamescrosswell in
[#​5610](getsentry/sentry-dotnet#5610)
- fix: telemetry dropped by user callbacks and by validation is now
counted in client reports by @​jamescrosswell in
[#​5607](getsentry/sentry-dotnet#5607)
- fix: exceptions thrown from BeforeBreadcrumb, log filters and
BeforeScreenshotCapture no longer reach the application by
@​jamescrosswell in
[#​5606](getsentry/sentry-dotnet#5606)
- fix: transaction processors no longer discard each other's results by
@​jamescrosswell in
[#​5621](getsentry/sentry-dotnet#5621)
- fix: Throw ArgumentException for empty traceId in
DynamicSamplingContext by @​chiliec in
[#​5599](getsentry/sentry-dotnet#5599)

### Dependencies ⬆️

#### Deps

- chore(deps): update Cocoa SDK to v9.30.0 by @​github-actions in
[#​5656](getsentry/sentry-dotnet#5656)
- chore(deps): update Cocoa SDK to v9.29.2 by @​github-actions in
[#​5624](getsentry/sentry-dotnet#5624)
- chore(deps): update Java SDK to v8.58.0 by @​github-actions in
[#​5622](getsentry/sentry-dotnet#5622)
- chore(deps): update Native SDK to v0.17.1 by @​github-actions in
[#​5625](getsentry/sentry-dotnet#5625)
- chore(deps): update Native SDK to v0.17.0 by @​github-actions in
[#​5614](getsentry/sentry-dotnet#5614)

### Other

- meta: remove duplicate Blank Issue template by @​SatvikMishra08 in
[#​5601](getsentry/sentry-dotnet#5601)

Commits viewable in [compare
view](getsentry/sentry-dotnet@6.11.1...6.12.0).
</details>

Updated
[Sentry.Extensions.Logging](https://github.com/getsentry/sentry-dotnet)
from 6.11.1 to 6.12.0.

<details>
<summary>Release notes</summary>

_Sourced from [Sentry.Extensions.Logging's
releases](https://github.com/getsentry/sentry-dotnet/releases)._

## 6.12.0

### Features ✨

- feat(otel): mark span processor based OpenTelemetry setup methods as
obsolete by @​jamescrosswell in
[#​5586](getsentry/sentry-dotnet#5586)

### Fixes 🐛

- fix(blazor): logging options set in UseSentry now take effect by
@​ric-oliv in
[#​5640](getsentry/sentry-dotnet#5640)
- fix(log4net): send event properties as log attributes on log4net 3.x
by @​jamescrosswell in
[#​5559](getsentry/sentry-dotnet#5559)
- fix: TraceIgnoreStatusCodes no longer drops outgoing HTTP requests
traced with OpenTelemetry by @​jamescrosswell in
[#​5643](getsentry/sentry-dotnet#5643)
- fix: an exception in BeforeSend or BeforeSendTransaction now drops the
item instead of sending it by @​jamescrosswell in
[#​5610](getsentry/sentry-dotnet#5610)
- fix: telemetry dropped by user callbacks and by validation is now
counted in client reports by @​jamescrosswell in
[#​5607](getsentry/sentry-dotnet#5607)
- fix: exceptions thrown from BeforeBreadcrumb, log filters and
BeforeScreenshotCapture no longer reach the application by
@​jamescrosswell in
[#​5606](getsentry/sentry-dotnet#5606)
- fix: transaction processors no longer discard each other's results by
@​jamescrosswell in
[#​5621](getsentry/sentry-dotnet#5621)
- fix: Throw ArgumentException for empty traceId in
DynamicSamplingContext by @​chiliec in
[#​5599](getsentry/sentry-dotnet#5599)

### Dependencies ⬆️

#### Deps

- chore(deps): update Cocoa SDK to v9.30.0 by @​github-actions in
[#​5656](getsentry/sentry-dotnet#5656)
- chore(deps): update Cocoa SDK to v9.29.2 by @​github-actions in
[#​5624](getsentry/sentry-dotnet#5624)
- chore(deps): update Java SDK to v8.58.0 by @​github-actions in
[#​5622](getsentry/sentry-dotnet#5622)
- chore(deps): update Native SDK to v0.17.1 by @​github-actions in
[#​5625](getsentry/sentry-dotnet#5625)
- chore(deps): update Native SDK to v0.17.0 by @​github-actions in
[#​5614](getsentry/sentry-dotnet#5614)

### Other

- meta: remove duplicate Blank Issue template by @​SatvikMishra08 in
[#​5601](getsentry/sentry-dotnet#5601)

Commits viewable in [compare
view](getsentry/sentry-dotnet@6.11.1...6.12.0).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants