Atya.Diagnostics.Tracing 1.2.0

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

Atya.Diagnostics.Tracing

Provider-agnostic tracing helpers for .NET applications built on System.Diagnostics.Activity.

Installation

dotnet add package Atya.Diagnostics.Tracing

What This Package Provides

  • DI registration for a package-owned ActivitySource.
  • Convenience methods for internal, client, server, producer, and consumer activities.
  • Correlation id ownership for all Atya packages: the default header name (CorrelationHeader), the id policy (CorrelationIdPolicy: 128 characters, alphanumeric plus - _ . :) and the ambient CorrelationContext carrier. It uses an AsyncLocal, tags Activity.Current with correlation.id when an Activity exists, and never uses Activity baggage or creates an Activity.
  • Common tag helpers for correlation, tenant, user, entity, dependency, messaging, outcomes, and errors.
  • Optional service/default tags applied to package-created activities.
  • Lightweight trace-context snapshots and W3C propagation header helpers.

This package intentionally does not configure OpenTelemetry SDK exporters, logging providers, ASP.NET Core middleware, or vendor-specific integrations.

Quick Start

using Atya.Diagnostics.Tracing.Abstractions;
using Atya.Diagnostics.Tracing.Extensions;

services.AddAtyaTracing(options =>
{
    options.ActivitySourceName = "Orders.Service";
    options.ActivitySourceVersion = "1.0.0";
    options.ServiceName = "Orders.Service";
    options.ServiceVersion = "1.0.0";
    _ = options.AddDefaultTag("deployment.environment", "production");
});

public sealed class OrderProcessor(IActivitySourceAccessor activitySource)
{
    public void Process(int orderId)
    {
        using var activity = activitySource.StartInternalActivity("orders.process");

        _ = activity?
            .SetOperationName("ProcessOrder")
            .SetEntity("Order", orderId)
            .MarkSuccess();
    }
}

Propagation

var snapshot = TraceContextSnapshot.CaptureCurrent();

if (snapshot is not null)
{
    var headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
    snapshot.WriteTo(headers);
}

Use snapshot.TryGetActivityContext(out var context) to recreate an ActivityContext from a captured W3C traceparent value.

Error Handling

MarkError(Exception) sets ActivityStatusCode.Error, outcome=error and error.type; the exception message is not recorded unless you call MarkError(Exception, recordMessage: true). Trace context carried by TraceContextSnapshot is limited to a well-formed W3C traceparent and a tracestate of at most 512 characters; hierarchical activity ids are never propagated as traceparent. ActivitySourceAccessor returns null without building tags when no listener is attached. MarkSuccess() sets ActivityStatusCode.Ok and outcome=success.

Compatibility

This package targets net10.0.

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

Showing the top 3 NuGet packages that depend on Atya.Diagnostics.Tracing:

Package Downloads
Atya.Diagnostics.Observation

Unified diagnostics observation helpers that compose logging, metrics, and tracing.

Atya.Web.Middleware

ASP.NET Core middleware that maps Atya exceptions and results to RFC 9457 ProblemDetails at the HTTP edge.

Atya.Http.Client

Typed HttpClient helpers that return Atya Result values, map RFC 9457 problem responses, and propagate correlation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 237 11/27/2026
1.1.0 158 11/27/2026
1.0.1 685 5/25/2026
1.0.0 252 5/23/2026