Atya.Diagnostics.OpenTelemetry
1.0.1
dotnet add package Atya.Diagnostics.OpenTelemetry --version 1.0.1
NuGet\Install-Package Atya.Diagnostics.OpenTelemetry -Version 1.0.1
<PackageReference Include="Atya.Diagnostics.OpenTelemetry" Version="1.0.1" />
<PackageVersion Include="Atya.Diagnostics.OpenTelemetry" Version="1.0.1" />
<PackageReference Include="Atya.Diagnostics.OpenTelemetry" />
paket add Atya.Diagnostics.OpenTelemetry --version 1.0.1
#r "nuget: Atya.Diagnostics.OpenTelemetry, 1.0.1"
#:package Atya.Diagnostics.OpenTelemetry@1.0.1
#addin nuget:?package=Atya.Diagnostics.OpenTelemetry&version=1.0.1
#tool nuget:?package=Atya.Diagnostics.OpenTelemetry&version=1.0.1
Atya.Diagnostics.OpenTelemetry
Atya.Diagnostics.OpenTelemetry is the host-facing OpenTelemetry integration package for Atya diagnostics libraries. It wires OpenTelemetry logging, tracing, and metrics, Atya service identity, resource metadata, optional instrumentations, and OTLP export through one dependency-injection entry point.
Supported Framework
This package intentionally targets net10.0 only. Consumers must run on .NET 10 or a compatible later runtime selected by the .NET host.
Installation
dotnet add package Atya.Diagnostics.OpenTelemetry
Quick Start
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry.Exporter;
services.AddAtyaOpenTelemetry(options =>
{
options.Observation.ServiceName = "Orders.Service";
options.Observation.ServiceVersion = "1.0.0";
options.EnableLogging = true;
options.ActivitySources.Add("Orders.Workflows");
options.Meters.Add("Orders.Business");
options.Resource.ServiceNamespace = "orders";
options.Resource.DeploymentEnvironment = "production";
options.Instrumentations.AspNetCore.Enabled = true;
options.Instrumentations.HttpClient.Enabled = true;
options.Instrumentations.SqlClient.Enabled = true;
options.Instrumentations.SqlClient.CaptureSqlText = false;
options.Instrumentations.EntityFrameworkCore.Enabled = true;
options.Instrumentations.EntityFrameworkCore.CaptureSqlText = false;
options.Instrumentations.GrpcClient.Enabled = true;
options.Instrumentations.Runtime.Enabled = true;
options.Exporters.Console.Enabled = true;
options.Exporters.Otlp.Enabled = true;
options.Exporters.Otlp.Endpoint = "http://otel-collector:4317";
options.Exporters.Otlp.Protocol = OtlpExportProtocol.Grpc;
});
Configuration Binding
Bind from the default OpenTelemetry configuration section:
{
"OpenTelemetry": {
"Observation": {
"ServiceName": "Orders.Service",
"ServiceVersion": "1.0.0"
},
"EnableLogging": true,
"EnableTracing": true,
"EnableMetrics": true,
"EnableObservationLogging": false,
"ActivitySources": [ "Orders.Workflows" ],
"Meters": [ "Orders.Business" ],
"Resource": {
"ServiceNamespace": "orders",
"DeploymentEnvironment": "production",
"Attributes": {
"team": "platform"
}
},
"Logging": {
"IncludeFormattedMessage": true,
"IncludeScopes": true,
"ParseStateValues": true
},
"Instrumentations": {
"AspNetCore": { "Enabled": true },
"HttpClient": { "Enabled": true },
"SqlClient": {
"Enabled": true,
"CaptureSqlText": false
},
"EntityFrameworkCore": {
"Enabled": true,
"CaptureSqlText": false
},
"GrpcClient": { "Enabled": true },
"Runtime": { "Enabled": true }
},
"Exporters": {
"Console": {
"Enabled": true
},
"Otlp": {
"Enabled": true,
"Endpoint": "http://otel-collector:4317",
"Protocol": "Grpc",
"Headers": {
"x-service": "orders"
}
}
}
}
}
services.AddAtyaOpenTelemetry(configuration);
Use a custom section when needed:
services.AddAtyaOpenTelemetry(configuration, "Diagnostics:OpenTelemetry");
Behavior
Observation.ServiceNameis required and is trimmed before registration.Observation.ActivitySourceNamedefaults toObservation.ServiceNamewhen omitted.Observation.MeterNamedefaults toObservation.ServiceNamewhen omitted.ActivitySourcesadds extra applicationActivitySourcenames beyond the package default.Metersadds extra applicationMeternames beyond the package default.- Options passed to
AddAtyaOpenTelemetryare validated immediately because the OpenTelemetry providers are configured during service registration. - Configure the package through the delegate or configuration section passed to
AddAtyaOpenTelemetry; laterservices.Configure<OpenTelemetryOptions>(...)calls do not rebuild the OpenTelemetry logging, tracing, or metrics providers. - Tracing and metrics are enabled by default.
- OpenTelemetry logging is disabled by default. Set
EnableLoggingtotrueto register the OpenTelemetry logging provider and export logs through configured exporters. - Observation-layer logging is disabled by default.
EnableObservationLoggingregisters Atya Observation logging services; it does not by itself register the OpenTelemetry logging provider.- ASP.NET Core, HttpClient, Runtime, console exporter, and OTLP exporter registrations are opt-in.
- SqlClient, Entity Framework Core, and gRPC client instrumentations are opt-in.
- SQL command text capture is disabled by default because command text can contain sensitive data.
- The package composes
Atya.Diagnostics.Observation; it does not define business metrics, activity names, or log catalogs.
Validation and Errors
Options are validated through Microsoft.Extensions.Options. Invalid options fail when options are resolved or when host startup validation runs.
Observation.ServiceNamecannot be null, empty, or whitespace.ActivitySourcesandMeterscannot contain null, empty, or whitespace names.- OTLP
Endpoint, when set, must be an absolute URI. - OTLP
Protocol, when set, must be a definedOtlpExportProtocolvalue such asGrpcorHttpProtobuf. - OTLP header names cannot be empty and cannot contain
,or=. - OTLP header values cannot be null and cannot contain
,.
Supported Instrumentations
| Instrumentation | Pipeline | Toggle |
|---|---|---|
| ASP.NET Core | Tracing and metrics | Instrumentations.AspNetCore.Enabled |
| HttpClient | Tracing and metrics | Instrumentations.HttpClient.Enabled |
| SqlClient | Tracing and metrics | Instrumentations.SqlClient.Enabled |
| Entity Framework Core | Tracing | Instrumentations.EntityFrameworkCore.Enabled |
| gRPC client | Tracing | Instrumentations.GrpcClient.Enabled |
| .NET Runtime | Metrics | Instrumentations.Runtime.Enabled |
SQL command text capture is controlled separately:
| Setting | Effect |
|---|---|
Instrumentations.SqlClient.CaptureSqlText |
Adds SQL command text to database spans for SqlClient as db.query.text and db.statement. |
Instrumentations.EntityFrameworkCore.CaptureSqlText |
Adds EF Core database command text to spans as db.query.text and db.statement. |
Leave SQL text capture disabled unless queries are known not to contain secrets or regulated data and telemetry access is appropriately restricted.
Supported Exporters
| Exporter | Toggle | Configuration |
|---|---|---|
| Console | Exporters.Console.Enabled |
Enabled |
| OTLP | Exporters.Otlp.Enabled |
Endpoint, Protocol, Headers for enabled logging, tracing, and metrics pipelines |
Package Boundaries
| Package | Responsibility |
|---|---|
Atya.Diagnostics.Logging |
Generic structured logging conventions and helpers |
Atya.Diagnostics.Tracing |
Generic ActivitySource, activity helpers, and trace context |
Atya.Diagnostics.Metrics |
Generic Meter, instruments, and metric tags |
Atya.Diagnostics.Observation |
Thin composition over Logging, Tracing, and Metrics |
Atya.Diagnostics.OpenTelemetry |
OpenTelemetry SDK setup, instrumentations, and exporters |
Compatibility and Versioning
The package follows semantic versioning. Breaking public API or behavior changes require a major version. Release versions use stable SemVer such as 1.0.0.
Runtime dependencies are centrally managed by the repository. Consumers should keep their own OpenTelemetry and Microsoft.Extensions package set coherent, especially in applications that already reference OpenTelemetry packages directly.
Entity Framework Core and gRPC client instrumentation currently depend on upstream OpenTelemetry prerelease instrumentation packages. They are included intentionally in the stable 1.0.0 package line and should be reviewed during dependency updates.
Support and Security
Use the repository issue templates for bug reports and feature requests. Report security issues privately according to the repository SECURITY.md; do not disclose suspected vulnerabilities in public issues.
Migration Notes
This is the initial 1.x package line. Future migrations will be documented in the repository CHANGELOG.md with any required code or configuration changes.
| 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.Diagnostics.Observation (>= 1.0.1)
- Atya.Foundation.Guards (>= 1.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Diagnostics.Abstractions (>= 10.0.8)
- Microsoft.Extensions.FileProviders.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Logging (>= 10.0.8)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.8)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Exporter.Console (>= 1.15.3)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.15.2)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.15.1-beta.1)
- OpenTelemetry.Instrumentation.GrpcNetClient (>= 1.15.1-beta.1)
- OpenTelemetry.Instrumentation.Http (>= 1.15.1)
- OpenTelemetry.Instrumentation.Runtime (>= 1.15.1)
- OpenTelemetry.Instrumentation.SqlClient (>= 1.15.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.