Skip to content

fix: return early from AddSentryOtlpExporter when DSN is the disable-SDK sentinel#5247

Merged
jamescrosswell merged 1 commit into
mainfrom
fix/5246-disable-sdk-dsn-otlp-escape-hatch
May 21, 2026
Merged

fix: return early from AddSentryOtlpExporter when DSN is the disable-SDK sentinel#5247
jamescrosswell merged 1 commit into
mainfrom
fix/5246-disable-sdk-dsn-otlp-escape-hatch

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

@jamescrosswell jamescrosswell commented May 20, 2026

Summary

When a caller passes SentryConstants.DisableSdkDsnValue (empty string "") to AddSentryOtlpExporter, the method previously threw an exception rather than disabling the integration. SentryConstants.DisableSdkDsnValue is a valid DSN value and should be handled gracefully.

  • Added an early-return check using Dsn.IsDisabled(dsnString) before the existing DSN validation, so disabled-SDK callers get back the builder unchanged.

Fixes #5246

…SDK sentinel

When the caller passes `SentryConstants.DisableSdkDsnValue` (empty string) to
`AddSentryOtlpExporter`, we now short-circuit before attempting to parse it as
a real DSN. This prevents a spurious `ArgumentException` when the SDK is
intentionally disabled.

Fixes #5246

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: James Crosswell <james.crosswell@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.11%. Comparing base (b682a76) to head (418bf82).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5247      +/-   ##
==========================================
- Coverage   74.12%   74.11%   -0.02%     
==========================================
  Files         508      508              
  Lines       18318    18320       +2     
  Branches     3583     3584       +1     
==========================================
- Hits        13579    13577       -2     
- Misses       3864     3871       +7     
+ Partials      875      872       -3     

☔ View full report in Codecov by Sentry.
📢 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 May 21, 2026 04:12
@jamescrosswell jamescrosswell requested a review from Flash0ver as a code owner May 21, 2026 04:12
@jamescrosswell jamescrosswell merged commit 42f6ca6 into main May 21, 2026
40 checks passed
@jamescrosswell jamescrosswell deleted the fix/5246-disable-sdk-dsn-otlp-escape-hatch branch May 21, 2026 11:52
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.

DisableSdkDsnValue does not disable SentryOtlpExporter, throws exception

2 participants