Atya.Diagnostics.Observation 1.0.1

Prefix Reserved
dotnet add package Atya.Diagnostics.Observation --version 1.0.1
                    
NuGet\Install-Package Atya.Diagnostics.Observation -Version 1.0.1
                    
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.Observation" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atya.Diagnostics.Observation" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Atya.Diagnostics.Observation" />
                    
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 Atya.Diagnostics.Observation --version 1.0.1
                    
#r "nuget: Atya.Diagnostics.Observation, 1.0.1"
                    
#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.Observation@1.0.1
                    
#: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.Observation&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Atya.Diagnostics.Observation&version=1.0.1
                    
Install as a Cake Tool

Atya.Diagnostics.Observation

Atya.Diagnostics.Observation is a thin composition package for the diagnostics building blocks.

It gives you one clean registration point for:

  • logging
  • tracing
  • metrics

This package does not replace the lower-level packages. It sits above them and helps you apply shared service identity and consistent naming.

What this package provides

  • AddAtyaObservation(...)
  • shared ObservationOptions
  • shared service identity mapping
  • consistent defaults for tracing and metrics names
  • optional enable/disable flags for logging, tracing, and metrics

What this package does not provide

This package intentionally does not configure:

  • OpenTelemetry SDK
  • OTLP / Jaeger / Zipkin / Prometheus exporters
  • Serilog
  • ASP.NET Core middleware
  • dashboards
  • sinks
  • vendor-specific integrations

Installation

dotnet add package Atya.Diagnostics.Observation

Basic usage

using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

services.AddAtyaObservation(options =>
{
    options.ServiceName = "Samples.OrderProcessor";
    options.ServiceVersion = "1.0.0";
});

For the common case, pass the service identity directly:

services.AddAtyaObservation("Samples.OrderProcessor", serviceVersion: "1.0.0");

Shared naming behavior

services.AddAtyaObservation(options =>
{
    options.ServiceName = "Orders.Service";
});

Defaults:

  • ActivitySourceName = ServiceName
  • MeterName = ServiceName

Override when needed:

services.AddAtyaObservation(options =>
{
    options.ServiceName = "Orders.Service";
    options.ActivitySourceName = "Orders.Tracing";
    options.MeterName = "Orders.Metrics";
});

Selective registration

services.AddAtyaObservation(options =>
{
    options.ServiceName = "Orders.Service";
    options.ConfigureLogging = true;
    options.ConfigureTracing = true;
    options.ConfigureMetrics = false;
});

Example with lower-level packages

public sealed class OrderProcessor
{
    private readonly ILogger<OrderProcessor> _logger;
    private readonly IActivitySourceAccessor _activitySourceAccessor;
    private readonly IMeterAccessor _meterAccessor;
    private readonly Counter<long> _requests;
    private readonly Histogram<double> _duration;

    public OrderProcessor(
        ILogger<OrderProcessor> logger,
        IActivitySourceAccessor activitySourceAccessor,
        IMeterAccessor meterAccessor)
    {
        _logger = logger;
        _activitySourceAccessor = activitySourceAccessor;
        _meterAccessor = meterAccessor;

        _requests = _meterAccessor.CreateCounter<long>("orders.processed");
        _duration = _meterAccessor.CreateHistogram<double>("orders.duration", unit: "ms");
    }

    public async Task ProcessAsync(Guid orderId, CancellationToken cancellationToken = default)
    {
        using var scope = _logger.BeginScope(new Dictionary<string, object?>
        {
            ["OperationName"] = "ProcessOrder",
            ["OrderId"] = orderId
        });

        using var activity = _activitySourceAccessor.StartInternalActivity("ProcessOrder");
        var startedAt = Stopwatch.GetTimestamp();

        _requests.Add(1);

        try
        {
            await Task.Delay(50, cancellationToken);
            _duration.Record(Stopwatch.GetElapsedTime(startedAt).TotalMilliseconds);
        }
        catch
        {
            _duration.Record(Stopwatch.GetElapsedTime(startedAt).TotalMilliseconds);
            throw;
        }
    }
}

When to use this package

Use this package when you want:

  • one diagnostics registration entry point
  • shared service identity across diagnostics packages
  • a simpler onboarding experience for new services
  • consistent diagnostics naming across your applications

Use the lower-level packages directly when you need more control over one specific area.

Validation

ServiceName is required and cannot be null, empty, or whitespace. Names and versions are trimmed before they are mapped to tracing and metrics options.

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 (1)

Showing the top 1 NuGet packages that depend on Atya.Diagnostics.Observation:

Package Downloads
Atya.Diagnostics.OpenTelemetry

OpenTelemetry configuration and instrumentation helpers for Atya diagnostics packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 412 5/25/2026
1.0.0 201 5/23/2026