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
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="Atya.Diagnostics.Metrics" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atya.Diagnostics.Metrics" Version="1.0.2" />
<PackageReference Include="Atya.Diagnostics.Metrics" />
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 Atya.Diagnostics.Metrics --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Atya.Diagnostics.Metrics, 1.0.2"
#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 Atya.Diagnostics.Metrics@1.0.2
#: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=Atya.Diagnostics.Metrics&version=1.0.2
#tool nuget:?package=Atya.Diagnostics.Metrics&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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
Thin diagnostics composition package over logging, tracing, and metrics. |
GitHub repositories
This package is not used by any popular GitHub repositories.