Altinn.AspNet.HealthChecks.OpenTelemetry 0.3.0

dotnet add package Altinn.AspNet.HealthChecks.OpenTelemetry --version 0.3.0
                    
NuGet\Install-Package Altinn.AspNet.HealthChecks.OpenTelemetry -Version 0.3.0
                    
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="Altinn.AspNet.HealthChecks.OpenTelemetry" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Altinn.AspNet.HealthChecks.OpenTelemetry" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Altinn.AspNet.HealthChecks.OpenTelemetry" />
                    
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 Altinn.AspNet.HealthChecks.OpenTelemetry --version 0.3.0
                    
#r "nuget: Altinn.AspNet.HealthChecks.OpenTelemetry, 0.3.0"
                    
#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 Altinn.AspNet.HealthChecks.OpenTelemetry@0.3.0
                    
#: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=Altinn.AspNet.HealthChecks.OpenTelemetry&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Altinn.AspNet.HealthChecks.OpenTelemetry&version=0.3.0
                    
Install as a Cake Tool

Altinn.AspNet.HealthChecks.OpenTelemetry

Experimental — pre-1.0.0. APIs may change without notice before the 1.0.0 release.

OpenTelemetry companion package to Altinn.AspNet.HealthChecks: a span processor that drops the noisy ASP.NET Core server spans produced by health check probes, so /health* traffic does not flood your traces.

Usage

tracerProviderBuilder
    .AddHealthCheckActivityFilter() // suppresses the five default /health* endpoints
    .AddOtlpExporter();             // exporters must be registered after the filter

Without arguments, the filter suppresses the five endpoints mapped by MapAltinnHealthChecks(): /alive, /health, /health/readiness, /health/startup and /health/deep. Pass your own route suffixes to replace the defaults:

tracerProviderBuilder.AddHealthCheckActivityFilter("/internal/health");

If you customise the endpoint paths, share the options object

The defaults above are hardcoded, so moving a path leaves the filter matching the old one — silently, with no error and no clue beyond a growing trace bill. Pass the same HealthCheckEndpointOptions instance to both, and the two cannot disagree:

var healthEndpoints = new HealthCheckEndpointOptions();
healthEndpoints.Deep.Path = "/internal/health/deep";
healthEndpoints.Startup.Disable();

builder.Services.AddOpenTelemetry().WithTracing(t => t
    .AddHealthCheckActivityFilter(healthEndpoints)   // suppresses exactly what gets mapped
    .AddOtlpExporter());

app.MapAltinnHealthChecks(healthEndpoints);

Disabled endpoints are not suppressed: nothing is mapped there, so a route ending that way belongs to your app and its spans are kept.

Matching is by case-insensitive route suffix, so the endpoints stay suppressed when the app is mounted under a path base. The flip side: any route ending in a suffix is suppressed too — if your API has a business route like /api/devices/{id}/health, its spans are dropped under the defaults. Pass explicit, more specific suffixes in that case.

How it works

The filter is a span processor that clears the Recorded flag on ASP.NET Core server spans whose http.route (or url.path) ends with one of the configured suffixes. Export processors skip spans that are not recorded, so the span reaches no exporter — but only exporters added after the filter, since processors run in registration order.

The decision is made when the server span ends, so child spans created while the probe ran (a database call inside a deep check, say) are still exported. To drop the whole trace, filter at the instrumentation level instead — that also avoids creating the span in the first place:

tracerProviderBuilder.AddAspNetCoreInstrumentation(o =>
    o.Filter = ctx => !ctx.Request.Path.StartsWithSegments("/health"));

Target frameworks

net8.0, net9.0, net10.0.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.3.0 113 8/23/2026
0.2.0 104 8/18/2026
0.1.0 96 8/17/2026