Gainsway.Observability
2.0.0
dotnet add package Gainsway.Observability --version 2.0.0
NuGet\Install-Package Gainsway.Observability -Version 2.0.0
<PackageReference Include="Gainsway.Observability" Version="2.0.0" />
<PackageVersion Include="Gainsway.Observability" Version="2.0.0" />
<PackageReference Include="Gainsway.Observability" />
paket add Gainsway.Observability --version 2.0.0
#r "nuget: Gainsway.Observability, 2.0.0"
#:package Gainsway.Observability@2.0.0
#addin nuget:?package=Gainsway.Observability&version=2.0.0
#tool nuget:?package=Gainsway.Observability&version=2.0.0
lib-dotnet-observability
This library add open telemetry configuration extensions for .NET Core Api
Configuration
- Install
Gainsway.Observabilitypackage in the target project
dotnet add package Gainsway.Observability
- Register the Observability services in the Infrastructure project:
# InfrastructureServiceExtensions.cs
var appMetadata = builder.Configuration.GetApplicationMetadata();
builder.AddObservability(serviceName: appMetadata.ServiceName, commitShortSha: appMetadata.CommitShortSha);
OPTIONAL To create tracing span for each method execution of a class, using .NET DI framework, the class's interface needs to be decorated by using one of the following extensions:
- Enable tracing for all services within a namespace
// Program.cs builder.Services.TraceAllServicesInNamespace("Gainsway");- Enable tracing for services' interfaces decorated with Traceable attribute
// Program.cs builder.Services.TraceDecoratedServices();// IMyService.cs [Traceable] public interface IMyService { // ... }- Enable tracing for services explicitly defined in the config
// Program.cs builder.Services.TraceServices([typeof(IMyService), typeof(IOtherService)]);OPTIONAL To create tracing span for each method execution of a class without using .NET DI framework:
using Gainsway.Observability // ... IMyService domainServiceInstance = new MyService(); IMyService decoratedInstance = TraceDecorator<IMyService>.Create(domainServiceInstance);
Environment variables
In OpenTelemetry .NET environment variable keys are retrieved using
IConfiguration which means they may be set using other mechanisms such as
defined in appSettings.json or specified on the command-line.
Exporter configuration
The OpenTelemetry Specification defines environment variables which can be used to configure the OTLP exporter and its associated processor (logs & traces) or reader (metrics).
All signals
The following environment variables can be used to override the default values of the
OtlpExporterOptions:Environment variable OtlpExporterOptionspropertyOTEL_EXPORTER_OTLP_ENDPOINTEndpointOTEL_EXPORTER_OTLP_HEADERSHeadersOTEL_EXPORTER_OTLP_TIMEOUTTimeoutMillisecondsOTEL_EXPORTER_OTLP_PROTOCOLProtocol(grpcorhttp/protobuf)Logs:
The following environment variables can be used to override the default values for the batch processor configured for logging:
Environment variable BatchExportLogRecordProcessorOptionspropertyOTEL_BLRP_SCHEDULE_DELAYScheduledDelayMillisecondsOTEL_BLRP_EXPORT_TIMEOUTExporterTimeoutMillisecondsOTEL_BLRP_MAX_QUEUE_SIZEMaxQueueSizeOTEL_BLRP_MAX_EXPORT_BATCH_SIZEMaxExportBatchSizeThe following environment variables can be used to override the default values of the
OtlpExporterOptionsused for logging when using the UseOtlpExporter extension:Environment variable OtlpExporterOptionspropertyUseOtlpExporter AddOtlpExporter OTEL_EXPORTER_OTLP_LOGS_ENDPOINTEndpointSupported Not supported OTEL_EXPORTER_OTLP_LOGS_HEADERSHeadersSupported Not supported OTEL_EXPORTER_OTLP_LOGS_TIMEOUTTimeoutMillisecondsSupported Not supported OTEL_EXPORTER_OTLP_LOGS_PROTOCOLProtocol(grpcorhttp/protobuf)Supported Not supported Metrics:
The following environment variables can be used to override the default value of the
TemporalityPreferencesetting for the reader configured for metrics when using OTLP exporter:Environment variable MetricReaderOptionspropertyOTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCETemporalityPreferenceThe following environment variables can be used to override the default values of the periodic exporting metric reader configured for metrics:
Environment variable PeriodicExportingMetricReaderOptionspropertyOTEL_METRIC_EXPORT_INTERVALExportIntervalMillisecondsOTEL_METRIC_EXPORT_TIMEOUTExportTimeoutMillisecondsThe following environment variables can be used to override the default values of the
OtlpExporterOptionsused for metrics when using the UseOtlpExporter extension:Environment variable OtlpExporterOptionspropertyUseOtlpExporter AddOtlpExporter OTEL_EXPORTER_OTLP_METRICS_ENDPOINTEndpointSupported Not supported OTEL_EXPORTER_OTLP_METRICS_HEADERSHeadersSupported Not supported OTEL_EXPORTER_OTLP_METRICS_TIMEOUTTimeoutMillisecondsSupported Not supported OTEL_EXPORTER_OTLP_METRICS_PROTOCOLProtocol(grpcorhttp/protobuf)Supported Not supported Tracing:
The following environment variables can be used to override the default values for the batch processor configured for tracing:
Environment variable BatchExportActivityProcessorOptionspropertyOTEL_BSP_SCHEDULE_DELAYScheduledDelayMillisecondsOTEL_BSP_EXPORT_TIMEOUTExporterTimeoutMillisecondsOTEL_BSP_MAX_QUEUE_SIZEMaxQueueSizeOTEL_BSP_MAX_EXPORT_BATCH_SIZEMaxExportBatchSizeThe following environment variables can be used to override the default values of the
OtlpExporterOptionsused for tracing when using the UseOtlpExporter extension:Environment variable OtlpExporterOptionspropertyUseOtlpExporter AddOtlpExporter OTEL_EXPORTER_OTLP_TRACES_ENDPOINTEndpointSupported Not supported OTEL_EXPORTER_OTLP_TRACES_HEADERSHeadersSupported Not supported OTEL_EXPORTER_OTLP_TRACES_TIMEOUTTimeoutMillisecondsSupported Not supported OTEL_EXPORTER_OTLP_TRACES_PROTOCOLProtocol(grpcorhttp/protobuf)Supported Not supported
Attribute limits
The OpenTelemetry Specification defines environment variables which can be used to configure attribute limits.
The following environment variables can be used to configure default attribute limits:
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMITOTEL_ATTRIBUTE_COUNT_LIMIT
The following environment variables can be used to configure span limits used for tracing:
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMITOTEL_SPAN_ATTRIBUTE_COUNT_LIMITOTEL_SPAN_EVENT_COUNT_LIMITOTEL_SPAN_LINK_COUNT_LIMITOTEL_EVENT_ATTRIBUTE_COUNT_LIMITOTEL_LINK_ATTRIBUTE_COUNT_LIMIT
The following environment variables can be used to configure log record limits used for logging:
OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMITOTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT
| 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
- Npgsql.OpenTelemetry (>= 10.0.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.14.0)
- OpenTelemetry.Extensions.Hosting (>= 1.14.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.14.0)
- OpenTelemetry.Instrumentation.AWS (>= 1.14.0)
- OpenTelemetry.Instrumentation.Http (>= 1.14.0)
- Scrutor (>= 7.0.0)
- Temporalio.Extensions.OpenTelemetry (>= 1.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 1,110 | 12/8/2025 |
| 1.2.12 | 198 | 12/5/2025 |
| 1.2.11 | 653 | 12/1/2025 |
| 1.2.10 | 1,602 | 10/2/2025 |
| 1.2.9 | 1,135 | 8/13/2025 |
| 1.2.8 | 828 | 6/23/2025 |
| 1.2.7 | 292 | 6/23/2025 |
| 1.2.6 | 430 | 6/4/2025 |
| 1.2.5 | 377 | 5/16/2025 |
| 1.2.4 | 466 | 4/25/2025 |
| 1.2.3 | 145 | 4/25/2025 |
| 1.2.2 | 1,716 | 12/19/2024 |
| 1.2.1 | 367 | 12/19/2024 |
| 1.2.0 | 183 | 12/18/2024 |