Raycynix.Extensions.Metrics
3.0.0
dotnet add package Raycynix.Extensions.Metrics --version 3.0.0
NuGet\Install-Package Raycynix.Extensions.Metrics -Version 3.0.0
<PackageReference Include="Raycynix.Extensions.Metrics" Version="3.0.0" />
<PackageVersion Include="Raycynix.Extensions.Metrics" Version="3.0.0" />
<PackageReference Include="Raycynix.Extensions.Metrics" />
paket add Raycynix.Extensions.Metrics --version 3.0.0
#r "nuget: Raycynix.Extensions.Metrics, 3.0.0"
#:package Raycynix.Extensions.Metrics@3.0.0
#addin nuget:?package=Raycynix.Extensions.Metrics&version=3.0.0
#tool nuget:?package=Raycynix.Extensions.Metrics&version=3.0.0
Raycynix.Extensions.Metrics
Version 3.0.0 provides provider-neutral metrics registration for .NET 10 applications.
What it contains
AddRaycynixMetrics()for registering the standardIMeterFactory- integration with the Microsoft.Extensions metrics pipeline
- the shared Raycynix meter from
Raycynix.Extensions.Metrics.Abstractions - compatibility with OpenTelemetry, OTLP, Aspire, Prometheus, and custom
MeterListenerconsumers
The package no longer owns a Prometheus registry, metrics endpoint, health checks, or application configuration. Export and transport are host concerns.
Registration
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddRaycynixMetrics();
The overload accepts the standard Microsoft metrics builder:
builder.Services.AddRaycynixMetrics(metrics =>
{
metrics.EnableMetrics("Raycynix.Extensions");
});
Creating instruments
using System.Diagnostics.Metrics;
using Raycynix.Extensions.Metrics.Abstractions;
public sealed class CheckoutMetrics
{
private readonly Counter<long> _orders;
private readonly Histogram<double> _duration;
public CheckoutMetrics(IMeterFactory meterFactory)
{
var meter = RaycynixMetrics.CreateMeter(meterFactory);
_orders = meter.CreateCounter<long>(
"raycynix.checkout.orders",
unit: "{order}",
description: "Number of processed checkout orders.");
_duration = meter.CreateHistogram<double>(
"raycynix.checkout.duration",
unit: "s",
description: "Checkout processing duration.");
}
public IDisposable Measure(string result) => _duration.MeasureDuration(
new KeyValuePair<string, object?>("raycynix.checkout.result", result));
public void RecordSuccess() => _orders.Add(
1,
new KeyValuePair<string, object?>("raycynix.checkout.result", "success"));
}
Prefer stable, bounded tag values. Do not use request IDs, user IDs, arbitrary URLs, or other unbounded values as metric tags.
Aspire and OTLP
Raycynix instruments use System.Diagnostics.Metrics, so an Aspire resource can export them through its normal OpenTelemetry/OTLP setup. Register the Raycynix meter in the resource process; the AppHost does not need to proxy or recreate resource metrics.
For ASP.NET Core instrumentation and exporters, use Raycynix.Extensions.Metrics.AspNetCore.
Migration from 2.x
Version 3.0 removes IMetricsService, IMetricCounter, IMetricGauge, IMetricHistogram, and MetricsConfiguration.
- inject
IMeterFactoryinstead ofIMetricsService - create standard
Counter<T>,UpDownCounter<T>,ObservableGauge<T>, andHistogram<T>instruments - use named
KeyValuePair<string, object?>tags instead of positional label arrays - configure OTLP or Prometheus in the host
- register health checks independently
| 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
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.Diagnostics (>= 10.0.10)
- Raycynix.Extensions.Metrics.Abstractions (>= 3.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Raycynix.Extensions.Metrics:
| Package | Downloads |
|---|---|
|
Raycynix.Extensions.Observability
Provider-neutral observability composition for Raycynix applications, combining standard .NET metrics, tracing, and ambient operation context registration. |
|
|
Raycynix.Extensions.Metrics.AspNetCore
Stable OpenTelemetry ASP.NET Core instrumentation for standard Raycynix System.Diagnostics.Metrics instruments, OTLP exporters, and Aspire. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v3.0.0 replaces the custom Prometheus-bound metrics service with standard System.Diagnostics.Metrics and IMeterFactory registration, removes ineffective endpoint and health-check options, and makes exporters an explicit host integration concern.