Atya.Diagnostics.Metrics
1.0.2
Prefix Reserved
dotnet add package Atya.Diagnostics.Metrics --version 1.0.2
NuGet\Install-Package Atya.Diagnostics.Metrics -Version 1.0.2
<PackageReference Include="Atya.Diagnostics.Metrics" Version="1.0.2" />
<PackageVersion Include="Atya.Diagnostics.Metrics" Version="1.0.2" />
<PackageReference Include="Atya.Diagnostics.Metrics" />
paket add Atya.Diagnostics.Metrics --version 1.0.2
#r "nuget: Atya.Diagnostics.Metrics, 1.0.2"
#:package Atya.Diagnostics.Metrics@1.0.2
#addin nuget:?package=Atya.Diagnostics.Metrics&version=1.0.2
#tool nuget:?package=Atya.Diagnostics.Metrics&version=1.0.2
Atya.Diagnostics.Metrics
Provider-agnostic metrics helpers for .NET applications built on System.Diagnostics.Metrics.
What this package provides
IMeterAccessor/MeterAccessor— managedMeterwrapper with DI supportMetricsOptions— configuration model for service name, version, andMeternameAddAtyaMetrics(...)— one-call DI registrationCounterExtensions/HistogramExtensions— convenience extensions for instrument creationMetricTagNames/MetricTags— well-known tag name constants and tag helpers
What this package does not provide
This package intentionally does not configure:
- OpenTelemetry SDK or exporters
- Prometheus / OTLP / Graphite exporters
- Serilog or any logging provider
- ASP.NET Core middleware
- Vendor-specific integrations
Installation
dotnet add package Atya.Diagnostics.Metrics
Basic usage
using System.Diagnostics.Metrics;
using Atya.Diagnostics.Metrics.Abstractions;
using Atya.Diagnostics.Metrics.Extensions;
using Atya.Diagnostics.Metrics.Tags;
using Microsoft.Extensions.DependencyInjection;
services.AddAtyaMetrics(options =>
{
options.MeterName = "Orders.Service";
options.MeterVersion = "1.0.0";
});
public class OrderProcessor
{
private readonly Counter<long> _ordersProcessed;
public OrderProcessor(IMeterAccessor meterAccessor)
{
_ordersProcessed = meterAccessor.CreateCounter<long>("orders.processed");
}
public void Process(int orderId)
{
_ordersProcessed.IncrementSuccess(MetricTags.Operation("ProcessOrder"));
// ...
}
}
Common tags
Use MetricTags and MetricTagValues to keep tag names and outcome values stable:
counter.IncrementFailure(
MetricTags.Operation("ProcessOrder"),
MetricTags.TenantId("tenant-001"));
Validation
AddAtyaMetrics validates that MeterName is not null or whitespace, and MeterAccessor
validates instrument names and observable callbacks before creating instruments.
| 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
- Atya.Foundation.Guards (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Atya.Diagnostics.Metrics:
| Package | Downloads |
|---|---|
|
Atya.Diagnostics.Observation
Unified diagnostics observation helpers that compose logging, metrics, and tracing. |
GitHub repositories
This package is not used by any popular GitHub repositories.