LevelUp.ServiceDefaults.Sentry 0.6.0-preview.1

This is a prerelease version of LevelUp.ServiceDefaults.Sentry.
dotnet add package LevelUp.ServiceDefaults.Sentry --version 0.6.0-preview.1
                    
NuGet\Install-Package LevelUp.ServiceDefaults.Sentry -Version 0.6.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LevelUp.ServiceDefaults.Sentry" Version="0.6.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LevelUp.ServiceDefaults.Sentry" Version="0.6.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="LevelUp.ServiceDefaults.Sentry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LevelUp.ServiceDefaults.Sentry --version 0.6.0-preview.1
                    
#r "nuget: LevelUp.ServiceDefaults.Sentry, 0.6.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LevelUp.ServiceDefaults.Sentry@0.6.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LevelUp.ServiceDefaults.Sentry&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=LevelUp.ServiceDefaults.Sentry&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Tool

LevelUp.ServiceDefaults.Sentry

Opt-in satellite for LevelUp.ServiceDefaults that bridges Sentry error reporting through OpenTelemetry, so captured events correlate to the active OTel trace.

Self-disables when no DSN is configured: the call registers nothing and does not throw, keeping the canonical shim uniform across services.

Usage

builder.AddLevelUpServiceDefaults()
       .AddLevelUpSentry(); // reads the DSN from the Sentry:Dsn configuration key

The whole Sentry: configuration section is bound onto SentryOptions, so settings such as Sentry:TracesSampleRate and Sentry:ProfilesSampleRate flow from config. For imperative overrides, pass a callback — it runs after config binding and the OpenTelemetry bridge, so its values win:

builder.AddLevelUpSentry(options => options.TracesSampleRate = 0.2);

PHI scrubber (#142)

AddLevelUpSentry is safe to wire with no further configuration. The satellite installs a structural scrubber on every event, transaction, and breadcrumb:

  • Request and response bodies, cookies, query strings, and the request environment are dropped.
  • Request headers survive only by name: Accept, Content-Type, Content-Length, traceparent, tracestate, and X-Correlation-ID by default.
  • Request paths survive only where a route template accounts for each segment. A segment bound to a {parameter} is replaced by the parameter name. A path no template matches is replaced by [Redacted]. The event's own route template (set by Sentry.AspNetCore from endpoint routing) is always consulted, so an endpoint-routed application needs no allowlist.
  • ServerName is cleared. SendDefaultPii is forced to false after the consumer callback runs.
  • User email, username, and IP address are erased. The user id is erased unless the host registers an IRedactorProvider (then it is redacted through the classification in SentryScrubberOptions.UserIdentifierClassification) or the consumer classifies it DataClassification.None.
  • Outbound HTTP spans and breadcrumbs get the same URL treatment; header attributes on spans follow the same allowlists.

Configure route templates and allowlists from the Sentry:Scrubber section or the callback:

builder.AddLevelUpSentry(
    configure: null,
    configureScrubber: scrub =>
    {
        scrub.RouteAllowlist.Add("/files/{**path}");   // paths with no endpoint
        scrub.AllowedRequestHeaders.Add("X-Tenant");
    });
{
  "Sentry": {
    "Dsn": "...",
    "Scrubber": { "RouteAllowlist": [ "/files/{**path}" ] }
  }
}

The scrubber runs as an ISentryEventProcessor and ISentryTransactionProcessor, which execute before any BeforeSend hook, so a consumer SetBeforeSend cannot displace it. SetBeforeBreadcrumb is owned by the satellite; chain a consumer breadcrumb filter through SentryScrubberOptions.BeforeBreadcrumb. A URL-named transaction (no route matched) whose name would change is dropped, because SentryTransaction.Name cannot be rewritten.

The scrubber does not rewrite exception messages or log text. Those are the first belt's job upstream of Sentry: typed failures and [LogProperties] redaction.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0-preview.1 63 11/12/2026
0.5.0 179 8/29/2026
0.4.0 887 7/7/2026
0.4.0-preview.1 93 6/26/2026
0.3.5 598 6/26/2026
0.3.4 186 6/24/2026
0.3.3 198 6/23/2026
0.3.2 156 6/23/2026
0.3.1 163 6/22/2026
0.3.0 478 6/21/2026
0.3.0-preview.1 92 6/21/2026
0.2.0 145 6/21/2026
0.1.0 135 6/21/2026