LevelUp.ServiceDefaults.Sentry
0.6.0-preview.1
dotnet add package LevelUp.ServiceDefaults.Sentry --version 0.6.0-preview.1
NuGet\Install-Package LevelUp.ServiceDefaults.Sentry -Version 0.6.0-preview.1
<PackageReference Include="LevelUp.ServiceDefaults.Sentry" Version="0.6.0-preview.1" />
<PackageVersion Include="LevelUp.ServiceDefaults.Sentry" Version="0.6.0-preview.1" />
<PackageReference Include="LevelUp.ServiceDefaults.Sentry" />
paket add LevelUp.ServiceDefaults.Sentry --version 0.6.0-preview.1
#r "nuget: LevelUp.ServiceDefaults.Sentry, 0.6.0-preview.1"
#:package LevelUp.ServiceDefaults.Sentry@0.6.0-preview.1
#addin nuget:?package=LevelUp.ServiceDefaults.Sentry&version=0.6.0-preview.1&prerelease
#tool nuget:?package=LevelUp.ServiceDefaults.Sentry&version=0.6.0-preview.1&prerelease
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, andX-Correlation-IDby 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. ServerNameis cleared.SendDefaultPiiis forced tofalseafter 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 inSentryScrubberOptions.UserIdentifierClassification) or the consumer classifies itDataClassification.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 | Versions 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. |
-
net10.0
- LevelUp.ServiceDefaults (>= 0.6.0-preview.1)
- Microsoft.Extensions.Compliance.Abstractions (>= 10.11.0)
- Sentry.AspNetCore (>= 6.11.1)
- Sentry.OpenTelemetry (>= 6.11.1)
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 |