Bsft.Observability
2.1.0
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
<PackageReference Include="Bsft.Observability" Version="2.1.0" />
<PackageVersion Include="Bsft.Observability" Version="2.1.0" />
<PackageReference Include="Bsft.Observability" />
paket add Bsft.Observability --version 2.1.0
#r "nuget: Bsft.Observability, 2.1.0"
#:package Bsft.Observability@2.1.0
#addin nuget:?package=Bsft.Observability&version=2.1.0
#tool nuget:?package=Bsft.Observability&version=2.1.0
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 | Versions 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. |
-
net10.0
- Bsft.Correlation.Abstractions (>= 2.1.0)
- Bsft.Instrumentation (>= 2.1.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- 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.12.0)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.14.0-beta.2)
- OpenTelemetry.Instrumentation.Http (>= 1.12.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.12.0)
-
net8.0
- Bsft.Correlation.Abstractions (>= 2.1.0)
- Bsft.Instrumentation (>= 2.1.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.19)
- 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.12.0)
- OpenTelemetry.Instrumentation.EntityFrameworkCore (>= 1.14.0-beta.2)
- OpenTelemetry.Instrumentation.Http (>= 1.12.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.12.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.