Atya.Diagnostics.Tracing
1.1.0
Prefix Reserved
See the version list below for details.
dotnet add package Atya.Diagnostics.Tracing --version 1.1.0
NuGet\Install-Package Atya.Diagnostics.Tracing -Version 1.1.0
<PackageReference Include="Atya.Diagnostics.Tracing" Version="1.1.0" />
<PackageVersion Include="Atya.Diagnostics.Tracing" Version="1.1.0" />
<PackageReference Include="Atya.Diagnostics.Tracing" />
paket add Atya.Diagnostics.Tracing --version 1.1.0
#r "nuget: Atya.Diagnostics.Tracing, 1.1.0"
#:package Atya.Diagnostics.Tracing@1.1.0
#addin nuget:?package=Atya.Diagnostics.Tracing&version=1.1.0
#tool nuget:?package=Atya.Diagnostics.Tracing&version=1.1.0
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.
- 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 | 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.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.15)
- Microsoft.Extensions.Options (>= 10.0.15)
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.