Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Last active November 24, 2025 00:59
Show Gist options
  • Select an option

  • Save AnthonyGiretti/a1765f27445d9bbd2ca62d5ef86fd610 to your computer and use it in GitHub Desktop.

Select an option

Save AnthonyGiretti/a1765f27445d9bbd2ca62d5ef86fd610 to your computer and use it in GitHub Desktop.
ASP.NET Core 10: New OpenTelemetry metrics for Identity
builder.Services
.AddOpenTelemetry()
.ConfigureResource(r => r.AddService(
serviceName: builder.Environment.ApplicationName,
serviceVersion: "1.0.0"))
.WithMetrics(metrics =>
{
// HTTP pipeline instrumentation (http.server.* etc.)
metrics.AddAspNetCoreInstrumentation();
// Built-in ASP.NET Core meters: hosting + routing + diagnostics + rate limiting
metrics.AddMeter(
"Microsoft.AspNetCore.Hosting",
"Microsoft.AspNetCore.Server.Kestrel",
"Microsoft.AspNetCore.Routing",
"Microsoft.AspNetCore.Diagnostics",
"Microsoft.AspNetCore.RateLimiting",
// NEW Identity metrics meter in ASP.NET Core 10
// Better end-to-end visibility: HTTP request → routing → middleware → Identity sign-in / sign-out.
"Microsoft.AspNetCore.Identity");
// You can also add runtime / HttpClient metrics if you want:
// metrics.AddRuntimeInstrumentation();
// metrics.AddHttpClientInstrumentation();
// Example exporter: Prometheus
metrics.AddPrometheusExporter();
});
var app = builder.Build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment