Raycynix.Extensions.Metrics.AspNetCore
3.1.0
dotnet add package Raycynix.Extensions.Metrics.AspNetCore --version 3.1.0
NuGet\Install-Package Raycynix.Extensions.Metrics.AspNetCore -Version 3.1.0
<PackageReference Include="Raycynix.Extensions.Metrics.AspNetCore" Version="3.1.0" />
<PackageVersion Include="Raycynix.Extensions.Metrics.AspNetCore" Version="3.1.0" />
<PackageReference Include="Raycynix.Extensions.Metrics.AspNetCore" />
paket add Raycynix.Extensions.Metrics.AspNetCore --version 3.1.0
#r "nuget: Raycynix.Extensions.Metrics.AspNetCore, 3.1.0"
#:package Raycynix.Extensions.Metrics.AspNetCore@3.1.0
#addin nuget:?package=Raycynix.Extensions.Metrics.AspNetCore&version=3.1.0
#tool nuget:?package=Raycynix.Extensions.Metrics.AspNetCore&version=3.1.0
Raycynix.Extensions.Metrics.AspNetCore
This package follows the shared version in Directory.Build.props. See CHANGELOG.md for release history.
This package 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.18.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.18.0)
- Raycynix.Extensions.Metrics (>= 3.1.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.
Raycynix.Extensions 3.1.0. All packages inherit the shared version from Directory.Build.props. See https://github.com/raycynix/Raycynix.Extensions/blob/HEAD/src/Raycynix.Extensions.Metrics.AspNetCore/CHANGELOG.md for package-specific changes and https://github.com/raycynix/Raycynix.Extensions/blob/HEAD/CHANGELOG.md for the release overview.