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
<PackageReference Include="Raycynix.Extensions.Metrics.AspNetCore" Version="3.0.0" />
<PackageVersion Include="Raycynix.Extensions.Metrics.AspNetCore" Version="3.0.0" />
<PackageReference Include="Raycynix.Extensions.Metrics.AspNetCore" />
paket add Raycynix.Extensions.Metrics.AspNetCore --version 3.0.0
#r "nuget: Raycynix.Extensions.Metrics.AspNetCore, 3.0.0"
#:package Raycynix.Extensions.Metrics.AspNetCore@3.0.0
#addin nuget:?package=Raycynix.Extensions.Metrics.AspNetCore&version=3.0.0
#tool nuget:?package=Raycynix.Extensions.Metrics.AspNetCore&version=3.0.0
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)withAddRaycynixAspNetCoreMetrics()orAddRaycynixPrometheusMetrics() - remove
UseRaycynixMetrics()andMapRaycynixMetrics() - 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
MetricsConfigurationsection
| Product | Versions 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. |
-
net10.0
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- Raycynix.Extensions.Metrics (>= 3.0.0)
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.