Atya.Diagnostics.Tracing
1.0.1
Prefix Reserved
dotnet add package Atya.Diagnostics.Tracing --version 1.0.1
NuGet\Install-Package Atya.Diagnostics.Tracing -Version 1.0.1
<PackageReference Include="Atya.Diagnostics.Tracing" Version="1.0.1" />
<PackageVersion Include="Atya.Diagnostics.Tracing" Version="1.0.1" />
<PackageReference Include="Atya.Diagnostics.Tracing" />
paket add Atya.Diagnostics.Tracing --version 1.0.1
#r "nuget: Atya.Diagnostics.Tracing, 1.0.1"
#:package Atya.Diagnostics.Tracing@1.0.1
#addin nuget:?package=Atya.Diagnostics.Tracing&version=1.0.1
#tool nuget:?package=Atya.Diagnostics.Tracing&version=1.0.1
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, error.type, and error.message when an exception has a non-empty message. 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.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.Tracing:
| 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.