Bsft.Observability 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bsft.Observability --version 2.1.0
                    
NuGet\Install-Package Bsft.Observability -Version 2.1.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="Bsft.Observability" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bsft.Observability" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Bsft.Observability" />
                    
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 Bsft.Observability --version 2.1.0
                    
#r "nuget: Bsft.Observability, 2.1.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 Bsft.Observability@2.1.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=Bsft.Observability&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Bsft.Observability&version=2.1.0
                    
Install as a Cake Tool

Bsft.Observability

The collection and export half of the observability family: AddBsftObservability wires the OpenTelemetry SDK for traces and metrics, exports over OTLP or the console, and discovers every instrumentation source the packages in the application advertised.

Install

dotnet add package Bsft.Observability

Requires Bsft.Instrumentation (pulled transitively) and Bsft.Correlation.Abstractions, plus the OpenTelemetry SDK with the ASP.NET Core, HttpClient, runtime and EF Core instrumentations and the OTLP and console exporters.

Register

services.AddBsftObservability(options =>
{
    options.ServiceName = "orders-api";
    options.OtlpEndpoint = new Uri("http://collector:4317");
});

// or bound from configuration, section "Bsft:Observability"
services.AddBsftObservability(configuration);

Nothing else is required. Source discovery runs at provider-build time rather than at registration time, so it sees every source regardless of whether a module was registered before or after this call — the order does not matter. Unset OTLP values fall back to the standard OTEL_* environment variables.

Configure

BsftObservabilityOptions.SectionName is "Bsft:Observability".

Option Default Effect
BsftObservabilityOptions.ServiceName null Resource service name; null leaves it to the SDK or OTEL_SERVICE_NAME.
BsftObservabilityOptions.ServiceVersion null Resource service version.
BsftObservabilityOptions.EnableTracing true Whether the tracer provider is configured at all.
BsftObservabilityOptions.EnableMetrics true Whether the meter provider is configured at all.
BsftObservabilityOptions.EnableLogging false Whether the OpenTelemetry logging provider is attached to ILoggingBuilder; opt-in because it changes the app's own logging pipeline.
BsftObservabilityOptions.EnableAspNetCoreInstrumentation true Incoming request traces and metrics.
BsftObservabilityOptions.EnableHttpClientInstrumentation true Outgoing HttpClient traces and metrics.
BsftObservabilityOptions.EnableEntityFrameworkCoreInstrumentation false EF Core traces; off because the instrumentation package is pre-release.
BsftObservabilityOptions.EnableRuntimeMetrics true Process runtime metrics (GC, threads).
BsftObservabilityOptions.EnableOtlpExporter true The OTLP exporter, which is the default sink.
BsftObservabilityOptions.OtlpEndpoint null OTLP endpoint; null leaves it to the SDK or OTEL_EXPORTER_OTLP_ENDPOINT.
BsftObservabilityOptions.OtlpProtocol null OTLP protocol; null leaves it to the SDK.
BsftObservabilityOptions.EnableConsoleExporter false Console exporter, useful in development.
BsftObservabilityOptions.CorrelationHeaderName X-Correlation-Id Request header read to tag spans with correlation_id (ObservabilityDefaults.CorrelationTagName).
BsftObservabilityOptions.AdditionalActivitySources empty Activity source names to collect beyond the discovered ones.
BsftObservabilityOptions.AdditionalMeters empty Meter names to collect beyond the discovered ones.
BsftObservabilityOptions.ConfigureTracerProvider null Hook run after the framework's tracer defaults.
BsftObservabilityOptions.ConfigureMeterProvider null Hook run after the framework's meter defaults.
BsftObservabilityOptions.ConfigureLoggerProvider null Hook run after the framework's logger defaults.

Validation: a service name may be absent but must not be blank when it is given at all, and the correlation header must be named. A failure names the member, and it is thrown from AddBsftObservability as well as on start.

Only correlation IDs matching ^[A-Za-z0-9._-]{1,128}\z are recorded as a span tag, mirroring CorrelationIdMiddleware, so unvalidated client input never reaches telemetry.

Extend

ConfigureTracerProvider and ConfigureMeterProvider are the seams: both run after the framework's own defaults, so a host adds an exporter, a sampler or a processor without this package knowing about it. A package that emits telemetry does not extend anything here — it advertises its source with AddBsftInstrumentationSource from Bsft.Instrumentation and is discovered.

Documentation

Topic page: docs/observability.md. Conventions: docs/package-conventions.md.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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

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.2.0 55 10/23/2026
2.1.0 78 9/28/2026