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
                    
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" 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" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Raycynix.Extensions.Metrics" />
                    
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 --version 3.0.0
                    
#r "nuget: Raycynix.Extensions.Metrics, 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@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&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Raycynix.Extensions.Metrics&version=3.0.0
                    
Install as a Cake Tool

Raycynix.Extensions.Metrics

Version 3.0.0 provides provider-neutral metrics registration for .NET 10 applications.

What it contains

  • AddRaycynixMetrics() for registering the standard IMeterFactory
  • integration with the Microsoft.Extensions metrics pipeline
  • the shared Raycynix meter from Raycynix.Extensions.Metrics.Abstractions
  • compatibility with OpenTelemetry, OTLP, Aspire, Prometheus, and custom MeterListener consumers

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 IMeterFactory instead of IMetricsService
  • create standard Counter<T>, UpDownCounter<T>, ObservableGauge<T>, and Histogram<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 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 (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.