Raycynix.Extensions.Metrics.AspNetCore 3.0.0

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

Raycynix.Extensions.Metrics.AspNetCore

Version 3.0.0 integrates Raycynix System.Diagnostics.Metrics instruments with OpenTelemetry and ASP.NET Core request instrumentation.

OTLP and Aspire

Use the provider-neutral registration when the application exports through OTLP, including Aspire service-default pipelines:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRaycynixAspNetCoreMetrics(metrics =>
{
    metrics.AddOtlpExporter(); // requires OpenTelemetry.Exporter.OpenTelemetryProtocol
});

var app = builder.Build();
app.Run();

AddRaycynixAspNetCoreMetrics registers the shared Raycynix meter, the standard IMeterFactory, and OpenTelemetry ASP.NET Core instrumentation. No metrics request middleware is required for OTLP export.

Prometheus scraping

Install OpenTelemetry.Exporter.Prometheus.AspNetCore explicitly, then compose it through the standard callback:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRaycynixAspNetCoreMetrics(metrics =>
    metrics.AddPrometheusExporter());

var app = builder.Build();

app.UseOpenTelemetryPrometheusScrapingEndpoint();

app.Run();

A custom exact path can be selected explicitly:

app.UseOpenTelemetryPrometheusScrapingEndpoint(
    context => context.Request.Path == "/internal/metrics");

The OpenTelemetry Prometheus exporter is currently distributed as a prerelease component. Prefer OTLP and an OpenTelemetry Collector for production environments when that topology is available. The scraping endpoint is not secured automatically; protect it at the network or application layer.

Migration from 2.x

  • replace AddRaycynixMetrics(configuration) with AddRaycynixAspNetCoreMetrics() or AddRaycynixPrometheusMetrics()
  • remove UseRaycynixMetrics() and MapRaycynixMetrics()
  • for Prometheus, explicitly install its prerelease exporter and add the official scraping middleware
  • move health-check registration and mapping to the application or observability composition
  • remove the obsolete MetricsConfiguration section
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Raycynix.Extensions.Metrics.AspNetCore:

Package Downloads
Raycynix.Extensions.Observability.AspNetCore

ASP.NET Core observability composition with correlation propagation, standard OpenTelemetry request metrics, tracing, and explicit health endpoint mapping.

GitHub repositories

This package is not used by any popular GitHub repositories.

v3.0.0 replaces prometheus-net middleware with the stable OpenTelemetry metrics pipeline, adds ASP.NET Core request instrumentation, supports the shared Raycynix System.Diagnostics.Metrics meter, and leaves exporter selection to the application.