Skip to content

Document the DisableSentryHttpMessageHandler configuration option#17012

Merged
jamescrosswell merged 4 commits intomasterfrom
jamescrosswell/docs/disable-sentry-http-message-handler
Apr 15, 2026
Merged

Document the DisableSentryHttpMessageHandler configuration option#17012
jamescrosswell merged 4 commits intomasterfrom
jamescrosswell/docs/disable-sentry-http-message-handler

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

Resolves getsentry/sentry-dotnet#4399

PRIORITY

  • None: Not urgent, can wait up to 1 week+

SLA

cc: @Flash0ver

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

…try HTTP instrumentation

When using OpenTelemetry.Instrumentation.Http with AddHttpClientInstrumentation(),
Sentry's built-in SentryHttpMessageHandler would also instrument HTTP requests,
resulting in duplicate spans. The DisableSentryHttpMessageHandler option (added in
5.1.0) prevents this, but was not documented on the OpenTelemetry setup page.

- Add OpenTelemetry.Instrumentation.Http package installation instructions
- Update setup example to include AddHttpClientInstrumentation() and
  DisableSentryHttpMessageHandler = true
- Add an alert explaining when and why to set this option

Fixes GH-4399
Document the DisableSentryHttpMessageHandler option in the .NET tracing
options reference page, including its default value, purpose, and the
version it was introduced (5.1.0).

Refs GH-4399
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Apr 15, 2026 6:23am
sentry-docs Ready Ready Preview, Comment Apr 15, 2026 6:23am

Request Review

@codeowner-assignment codeowner-assignment bot requested a review from a team March 18, 2026 03:30
Comment thread platform-includes/performance/opentelemetry-setup/dotnet.mdx
@codeowner-assignment codeowner-assignment bot requested a review from a team April 15, 2026 06:11
Comment on lines 17 to +26
// options.SendDefaultPii = true;
options.TracesSampleRate = 1.0;
options.UseOpenTelemetry(); // <-- Configure Sentry to use OpenTelemetry trace information
options.DisableSentryHttpMessageHandler = true; // <-- Disable Sentry's HttpClient instrumentation to avoid duplicate spans
});
```

<Alert level="info" title="HTTP Client Instrumentation">
When using `AddHttpClientInstrumentation()` from `OpenTelemetry.Instrumentation.Http`, you **must** set `DisableSentryHttpMessageHandler = true` in the Sentry options. This prevents Sentry's built-in `SentryHttpMessageHandler` from also instrumenting HTTP requests and creating duplicate spans.
</Alert>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The OpenTelemetry setup example unconditionally includes optional HTTP instrumentation, potentially misleading users into adding unnecessary dependencies and configuration.
Severity: LOW

Suggested Fix

Update the documentation to clarify that HTTP instrumentation is optional. Either remove AddHttpClientInstrumentation() and DisableSentryHttpMessageHandler = true from the main example and show it as a separate, optional step, or add a prominent note above the code block explaining its optional nature.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: platform-includes/performance/opentelemetry-setup/dotnet.mdx#L17-L26

Potential issue: The main OpenTelemetry setup documentation in `dotnet.mdx` includes
`AddHttpClientInstrumentation()` and `DisableSentryHttpMessageHandler = true` in the
basic example. This is misleading because HTTP client instrumentation is an optional
feature. Users following the guide may unnecessarily add the
`OpenTelemetry.Instrumentation.Http` package, call `AddHttpClientInstrumentation()`, and
disable the Sentry message handler, leading to unnecessary dependencies and
configuration overhead. While an alert box clarifies the conditional requirement, the
code example itself presents these optional settings as standard.

@jamescrosswell jamescrosswell merged commit db9ca2b into master Apr 15, 2026
18 checks passed
@jamescrosswell jamescrosswell deleted the jamescrosswell/docs/disable-sentry-http-message-handler branch April 15, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: DisableSentryHttpMessageHandler

3 participants