Repository navigation
feat!: upgrade Sentry SDK to 7.1.0 - #218
Open
Thorstein Løkensgard (loekensgard) wants to merge 1 commit into
Open
Thorstein Løkensgard (loekensgard) wants to merge 1 commit into
Thorstein Løkensgard (loekensgard) wants to merge 1 commit into
Conversation
Bump Sentry.AspNetCore and Sentry.Serilog together to 7.1.0 and rework UseSentry: the Serilog sink no longer initializes the SDK in Sentry 7, so the extension initializes SentrySdk itself from the same configuration section and closes it when the host disposes the logger. BREAKING CHANGE: Sentry SDK major version 7. Requests ending in 301, 305-399 or 401-404 are no longer traced by default, and removed SentryOptions config keys (EnableLogs, EnableMetrics, ...) are ignored. Apps that initialize Sentry themselves should not set a DSN in the Sentry section.
Thorstein Løkensgard (loekensgard)
requested a review
from a team
as a code owner
November 30, 2026 13:07
This was referenced Nov 30, 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.
Replaces #215, which bumped only
Sentry.AspNetCoreto 7.1.0 and leftSentry.Serilogat 6.12.1 - an unsupported mix, since NuGet unifies the Sentry core to 7.x while the 6.x sink runs against it.What
Sentry.AspNetCoreandSentry.Serilogtogether from 6.13.0 to 7.1.0.UseSentry: in Sentry 7 the Serilog sink no longer initializes the SDK (SentrySerilogOptionsno longer derives fromSentryOptions, and a DSN set on the sink fails at startup by design).Design
The public contract is unchanged: DSN in the
Sentrysection gates initialization, everything else binds from the same section.SentrySdk.Initruns from the extension, bound to the same configuration section, with the host environment as fallback (as before).options.UseSerilog()applies SerilogLogContextproperties to Sentry events from the first event (Sentry 7's documented flow).SentryShutdownSinkholds the init handle and rides Serilog's disposal pipeline: when the host disposes the logger, the SDK is flushed and closed. This restores the 6.x ownership model where the sink disposed the SDK.WriteTo.Sentry) still binds its level settings from the same section.The v7-native alternative (
Sentry.Extensions.Hosting'sUseSentryon the host builder) does not work from this extension point:UseIntilityLoggingconfigures Serilog lazily from inside theUseSerilogcallback, which runs after the host builder has snapshotted its service collection, so anIHostBuilder.ConfigureServicescall from there is silently lost.Consumer notes
SentryOptionsconfig keys (EnableLogs,EnableMetrics, ...) are silently ignored.UseSentryfromSentry.AspNetCore) should not set a DSN in theSentrysection; Sentry warns about double initialization and the last init wins.Tests
SentryLoggingTestscovers the lifecycle end to end through the public seam (UseIntilityLogging+ config): with a DSN the SDK initializes and closes with the host; without a DSN nothing initializes.