Skip to content

Document .NET 11 native OpenTelemetry HTTP server metrics and traces - #37528

Open
wadepickett with Copilot wants to merge 11 commits into
mainfrom
copilot/update-opentelemetry-docs-aspnet-core-11
Open

Document .NET 11 native OpenTelemetry HTTP server metrics and traces#37528
wadepickett with Copilot wants to merge 11 commits into
mainfrom
copilot/update-opentelemetry-docs-aspnet-core-11

Conversation

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

In ASP.NET Core 11, the HTTP server Activity emits the required OpenTelemetry HTTP server-span semantic-convention tags by default (SuppressActivityOpenTelemetryData now defaults to false), making the OpenTelemetry.Instrumentation.AspNetCore package optional. Adopters who drop the package hit a pitfall (opentelemetry-dotnet#7426): custom child spans are silently dropped when the framework activity source isn't registered.

Updates aspnetcore/log-mon/metrics/metrics.md (moniker-gated to >= aspnetcore-11.0):

  • OpenTelemetry overview — Lead paragraph stating built-in HTTP server metrics/traces are compliant with the required parts of the semantic conventions and the instrumentation package is optional.
  • Tracing pitfall[!IMPORTANT] callout explaining that the request activity is created but unrecorded when the source isn't registered, so the default ParentBased sampler drops custom child spans, plus the fix.
  • Meters and counters — Cross-link reinforcing package-optional consumption in .NET 11+.

The registration snippet uses the activity source name Microsoft.AspNetCore (verified against dotnet/aspnetcore WebHostBuilder.cs and the shipped release-notes include) — not the meter name Microsoft.AspNetCore.Hosting:

builder.Services.AddOpenTelemetry()
    .WithTracing(tracing => tracing
        .AddSource("Microsoft.AspNetCore")   // request activity source; not the meter name
        .AddSource("MyApp")
        .AddConsoleExporter());

Scope

Limited to metrics.md. The built-in.md/built-in-http.md reference pages are tracked separately in #37272; YARP and SignalR articles are candidates for their own article-level tracking issues per the triage summary.


Internal previews

File Preview link
aspnetcore/log-mon/metrics/metrics.md aspnetcore/log-mon/metrics/metrics

Copilot AI and others added 2 commits August 24, 2026 21:46
…etrics.md

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
…callout

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copilot AI changed the title [WIP] Update OpenTelemetry documentation for ASP.NET Core 11 Document .NET 11 native OpenTelemetry HTTP server metrics and traces Aug 24, 2026
Copilot AI requested a review from wadepickett August 24, 2026 21:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ASP.NET Core metrics guidance to document .NET 11’s native OpenTelemetry HTTP server metrics/tracing behavior (including the pitfall when the Microsoft.AspNetCore activity source isn’t registered) and refreshes related wording/metadata.

Changes:

  • Updated article metadata and introductory explanations of metrics/collection.
  • Added an >= aspnetcore-11.0 OpenTelemetry overview and an [!IMPORTANT] tracing pitfall callout with an AddSource("Microsoft.AspNetCore") fix.
  • Refreshed wording throughout and expanded the “meters and counters” closing guidance to mention OpenTelemetry semantic convention alignment in ASP.NET Core 11+.
Suppressed comments (3)

aspnetcore/log-mon/metrics/metrics.md:122

  • Grammar: the comma after “metadata” is incorrect here. Consider removing it so the sentence reads naturally.
You can exclude HTTP requests to an endpoint from metrics by adding metadata, with either the [DisableHttpMetrics](xref:Microsoft.AspNetCore.Http.DisableHttpMetricsAttribute) attribute or the [DisableHttpMetrics](xref:Microsoft.AspNetCore.Builder.HttpMetricsEndpointConventionBuilderExtensions.DisableHttpMetrics``1(``0)) method:

aspnetcore/log-mon/metrics/metrics.md:333

  • “these meters emit data that conforms … [HTTP server semantic conventions]” reads like it applies to all ASP.NET Core meters/counters in the linked list. The HTTP server semantic conventions only apply to the HTTP server meters (for example Microsoft.AspNetCore.Hosting and Microsoft.AspNetCore.Server.Kestrel), so it should be scoped accordingly to avoid overclaiming.
For a list of ASP.NET Core meters and counters, see [ASP.NET Core metrics](/dotnet/core/diagnostics/built-in-metrics-aspnetcore). In ASP.NET Core 11 and later, these meters emit data that conforms to the required parts of the [OpenTelemetry HTTP server semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/). You can consume them with the OpenTelemetry SDK without the `OpenTelemetry.Instrumentation.AspNetCore` package.

aspnetcore/log-mon/metrics/metrics.md:191

  • This sentence points to built-in-http, which is the HTTP-specific reference page. To avoid implying it lists all built-in instruments, clarify that it’s the list of built-in HTTP instruments/attributes.
Starting in ASP.NET Core 11, the framework's built-in HTTP server metrics and traces comply with the required parts of the [OpenTelemetry HTTP server semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/). The HTTP server request activity emits these attributes by default, matching the built-in metrics. As a result, the [`OpenTelemetry.Instrumentation.AspNetCore`](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNetCore) NuGet package is optional for collecting HTTP server metrics and traces. The sample in this article uses only the built-in meters (`Microsoft.AspNetCore.Hosting` and `Microsoft.AspNetCore.Server.Kestrel`) and doesn't reference the instrumentation package. For the list of built-in instruments and their attributes, see <xref:log-mon/metrics/built-in-http>.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aspnetcore/log-mon/metrics/metrics.md Outdated
Comment thread aspnetcore/log-mon/metrics/metrics.md Outdated
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Comment thread aspnetcore/log-mon/metrics/metrics.md Outdated
Co-authored-by: Wade Pickett <wpickett@microsoft.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread aspnetcore/log-mon/metrics/metrics.md Outdated
Clarified instructions for enabling OpenTelemetry tracing in ASP.NET Core without the instrumentation package. Added example code for registering the HTTP server activity source.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

aspnetcore/log-mon/metrics/metrics.md:8

  • The PR metadata shows the current date as 2026-08-25, but ms.date is set to 08/24/2026. Repo guidance requires ms.date to be set to today's date (MM/DD/YYYY).
ms.date: 08/24/2026

Comment thread aspnetcore/log-mon/metrics/metrics.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

aspnetcore/log-mon/metrics/metrics.md:8

  • ms.date should match today’s date (MM/DD/YYYY). The PR updates substantial content in this article, but ms.date is set to 08/24/2026 while today is 08/25/2026.
ms.date: 08/24/2026

@wadepickett
wadepickett marked this pull request as ready for review August 25, 2026 01:03
@wadepickett
wadepickett requested a review from tdykstra August 25, 2026 01:08
Comment on lines +193 to +194
> [!IMPORTANT]
> When you enable OpenTelemetry *tracing* (in addition to metrics) without the `OpenTelemetry.Instrumentation.AspNetCore` package, register the framework's HTTP server <xref:System.Diagnostics.ActivitySource> so that the request activity is recorded. ASP.NET Core's HTTP server activity source is named `Microsoft.AspNetCore`, and the framework creates a request activity named `Microsoft.AspNetCore.Hosting.HttpRequestIn` for each request to propagate trace context. If the `Microsoft.AspNetCore` source isn't registered with the OpenTelemetry SDK, the request activity isn't recorded, and the default `ParentBased` sampler silently drops any custom child spans started during the request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on the target audience (someone adding telemetry vs. someone upgrading from 10 to 11 that already has telemetry), it might be worth calling out that removing OpenTelemetry.Instrumentation.AspNetCore will cause some recommended attributes to no longer be emitted (and also the conditionally required url.query attribute, see dotnet/aspnetcore#65873).

The OTel instrumentation also registers additional metrics and sources for Blazor and SignalR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a shot at addressing this, see the latest version now after my last commit. Thanks.

Clarify the differences between built-in instrumentation and the OpenTelemetry package for HTTP server metrics in ASP.NET Core 11. Provide guidance on registering activity sources for tracing.
Clarified the role of the package in enabling telemetry for Blazor and SignalR, and emphasized the need to register sources and meters manually if the package is removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updates for OpenTelemetry documentation for ASP.NET Core 11

4 participants