OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule 1.14.0

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

ASP.NET Telemetry HttpModule for OpenTelemetry

Status
Stability Stable
Code Owners @open-telemetry/dotnet-contrib-maintainers

NuGet version badge NuGet download count badge codecov.io

The ASP.NET Telemetry HttpModule is a skeleton to enable distributed tracing and metrics of incoming ASP.NET requests using the OpenTelemetry API.

Usage

Step 1: Install NuGet package

If you are using the traditional packages.config reference style, a web.config transform should run automatically and configure the TelemetryHttpModule for you. If you are using the more modern PackageReference style, this may need to be done manually. For more information, see: Migrate from packages.config to PackageReference.

To configure your web.config manually, add this:

<system.webServer>
    <modules>
        <add
            name="TelemetryHttpModule"
            type="OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule,
                OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule"
            preCondition="integratedMode,managedHandler" />
    </modules>
</system.webServer>

Step 2: Register hooks

TelemetryHttpModule provides hooks to create and manage activities and metrics.

To automatically register the entire infrastructure using OpenTelemetry, please use the OpenTelemetry.Instrumentation.AspNet NuGet package.

Options

TelemetryHttpModule provides a static options property (TelemetryHttpModule.Options) which can be used to configure the TelemetryHttpModule and listen to events it fires.

TextMapPropagator

TextMapPropagator controls how trace context will be extracted from incoming HTTP request messages. By default, W3C Trace Context is enabled.

The OpenTelemetry API ships with a handful of standard implementations which may be used, or you can write your own by deriving from the TextMapPropagator class.

To add support for Baggage propagation in addition to W3C Trace Context, use:

TelemetryHttpModuleOptions.TextMapPropagator = new CompositeTextMapPropagator(
    new TextMapPropagator[]
    {
        new TraceContextPropagator(),
        new BaggagePropagator(),
    });

When using the OpenTelemetry.Instrumentation.AspNet TelemetryHttpModuleOptions.TextMapPropagator is automatically initialized to the SDK default propagator (Propagators.DefaultTextMapPropagator) which by default supports W3C Trace Context & Baggage.

Events

OnRequestStartedCallback, OnRequestStoppedCallback, and OnExceptionCallback are provided on TelemetryHttpModuleOptions and will be fired by the TelemetryHttpModule as requests are processed.

A typical use case for the OnRequestStartedCallback event is to create an activity based on the HttpContextBase and ActivityContext.

OnRequestStoppedCallback and OnExceptionCallback are needed to add information (tags, events, and/or links) to the created Activity based on the request, response, and/or exception event being fired.

Product Compatible and additional computed target framework versions.
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule:

Package Downloads
OpenTelemetry.Instrumentation.AspNet

ASP.NET instrumentation for OpenTelemetry .NET.

C3D.Extensions.SystemWeb.OpenTelemetry.Application

Assembly Version: 0.1.0.0 File Version: 0.1.122.35648 Informational Version: 0.1.122+408be8c6f1 Build Configuration: Release

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.14.0 3,133 11/27/2025
1.14.0-rc.1 6,907 11/13/2025
1.13.0-rc.1 6,865 10/28/2025
1.13.0-beta.2 3,134 10/22/2025
1.13.0-beta.1 10,168 10/15/2025
1.12.0-beta.2 19,759 9/18/2025
1.12.0-beta.1 104,740 5/5/2025
1.11.0-beta.2 79,762 3/5/2025
1.11.0-beta.1 50,519 1/27/2025
1.10.0-beta.1 71,325 12/9/2024
1.9.0-beta.1 550,166 6/18/2024
1.8.0-beta.3 181,008 5/23/2024
1.8.0-beta.2 156,491 4/17/2024
1.8.0-beta.1 38,379 4/5/2024
1.7.0-beta.2 126,092 2/7/2024
1.7.0-beta.1 70,723 12/20/2023
1.6.0-beta.2 141,816 11/6/2023
1.6.0-beta.1 30,431 10/12/2023
1.0.0-rc9.9 230,216 6/9/2023
1.0.0-rc9.8 284,144 2/28/2023
1.0.0-rc9.7 137,868 11/28/2022
1.0.0-rc9.6 66,784 9/28/2022
1.0.0-rc9.5 114,391 6/21/2022
1.0.0-rc9.4 63,656 6/3/2022
1.0.0-rc9.3 10,160 4/20/2022
1.0.0-rc9.2 28,863 4/13/2022
1.0.0-rc9.1 85,100 3/30/2022
1.0.0-rc9 102,046 2/3/2022
1.0.0-rc8 101,932 10/8/2021