CasCap.Common.OpenTelemetry
4.12.4
Prefix Reserved
See the version list below for details.
dotnet add package CasCap.Common.OpenTelemetry --version 4.12.4
NuGet\Install-Package CasCap.Common.OpenTelemetry -Version 4.12.4
<PackageReference Include="CasCap.Common.OpenTelemetry" Version="4.12.4" />
<PackageVersion Include="CasCap.Common.OpenTelemetry" Version="4.12.4" />
<PackageReference Include="CasCap.Common.OpenTelemetry" />
paket add CasCap.Common.OpenTelemetry --version 4.12.4
#r "nuget: CasCap.Common.OpenTelemetry, 4.12.4"
#:package CasCap.Common.OpenTelemetry@4.12.4
#addin nuget:?package=CasCap.Common.OpenTelemetry&version=4.12.4
#tool nuget:?package=CasCap.Common.OpenTelemetry&version=4.12.4
CasCap.Common.OpenTelemetry
Reusable OpenTelemetry configuration with standard metrics, traces, and log exporters via OTLP gRPC, built on top of CasCap.Common.Abstractions and CasCap.Common.Logging.Serilog.
Installation
dotnet add package CasCap.Common.OpenTelemetry
Purpose
Provides a single InitializeOpenTelemetry extension method on WebApplicationBuilder that registers the full OpenTelemetry pipeline (metrics, traces, and logs) with standard ASP.NET Core instrumentations. Configuration is driven by IMetricsConfig — the OTLP endpoint, service name, and metric prefix are all sourced from the application's configuration record.
Target frameworks: net8.0, net9.0, net10.0
Extensions
| Extension | Description |
|---|---|
OpenTelemetryExtensions.InitializeOpenTelemetry(builder, metricsConfig, connectionMultiplexer, gitMetadata, configureMetrics?, configureTracing?) |
Registers OpenTelemetry metrics, traces, and logs with OTLP gRPC export |
MeterProviderBuilderExtensions.AddHistogramView(builder, metricNamePrefix, instrumentName, boundaries) |
Registers an explicit-bucket view for the {prefix}.{instrumentName} histogram, returning the builder for chaining |
MetricBoundaries.Symmetric(positiveBoundaries) |
Mirrors a positive-only boundary set into a signed set straddling zero ([-max … -min, 0, min … max]) |
Signed histograms
The OpenTelemetry default histogram boundaries are non-negative, so an instrument recording signed measurements collapses every negative observation into the single le="0" bucket, making the negative half of the distribution — and any quantile query over it — meaningless. Supply explicit boundaries via the configureMetrics hook:
builder.InitializeOpenTelemetry(metricsConfig, gitMetadata,
configureMetrics: metrics => metrics
.AddHistogramView(metricsConfig.MetricNamePrefix, "widget.delta", MetricBoundaries.Symmetric(1, 5, 10, 50)));
Only the *_bucket series are affected — _sum and _count are unchanged.
Behaviour
- Skips registration when
IMetricsConfig.OtlpExporterEndpointisnull— safe for development without an OTEL collector. - Development mode: Registers a Prometheus exporter for local
/metricsscraping. - Production mode: Adds ASP.NET Core, runtime, and process instrumentations for metrics; ASP.NET Core, HTTP client, and Redis instrumentations for traces.
- App-specific hooks: Optional
Action<MeterProviderBuilder>andAction<TracerProviderBuilder>callbacks for custom histogram views, additional trace sources, etc.
Configuration
The extension reads configuration from any IMetricsConfig implementation:
| Property | Type | Description |
|---|---|---|
MetricNamePrefix |
string |
Meter name and metric prefix (e.g. "haus", "cas") |
OtelServiceName |
string |
OpenTelemetry service name resource attribute |
OtlpExporterEndpoint |
Uri? |
OTLP gRPC endpoint (e.g. http://localhost:4317/). null disables telemetry. |
Configuration Examples
Minimal (disables telemetry):
{
"AppConfig": {
"MetricNamePrefix": "haus",
"OtelServiceName": "CasCap.App"
}
}
Fully configured:
{
"AppConfig": {
"MetricNamePrefix": "haus",
"OtelServiceName": "CasCap.App",
"OtlpExporterEndpoint": "http://opentelemetry-collector.monitoring.svc:4317"
}
}
Dependencies
NuGet Packages
| Package | Purpose |
|---|---|
| OpenTelemetry.Exporter.OpenTelemetryProtocol | OTLP gRPC exporter for metrics, traces, and logs |
| OpenTelemetry.Exporter.Prometheus.AspNetCore | Prometheus /metrics endpoint (development) |
| OpenTelemetry.Extensions.Hosting | AddOpenTelemetry() host integration |
| OpenTelemetry.Instrumentation.AspNetCore | HTTP request metrics and traces |
| OpenTelemetry.Instrumentation.Http | Outbound HTTP client traces |
| OpenTelemetry.Instrumentation.Process | CPU and memory utilization metrics |
| OpenTelemetry.Instrumentation.Runtime | GC, thread pool, and assembly metrics |
| OpenTelemetry.Instrumentation.StackExchangeRedis | Redis command traces |
| StackExchange.Redis | Redis connection multiplexer type |
Project References
| Project | Purpose |
|---|---|
CasCap.Common.Abstractions |
IMetricsConfig interface |
CasCap.Common.Logging.Serilog |
Serilog fallback warning when endpoint is null |
CasCap.Common.Services |
GitMetadata record for resource attributes |
| 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 is compatible. 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
- CasCap.Common.Abstractions (>= 4.12.4)
- CasCap.Common.Logging.Serilog (>= 4.12.4)
- CasCap.Common.Net (>= 4.12.4)
- CasCap.Common.Services (>= 4.12.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Exporter.Prometheus.AspNetCore (>= 1.15.3-beta.1)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Process (>= 1.15.1-beta.1)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- OpenTelemetry.Instrumentation.StackExchangeRedis (>= 1.15.1-beta.1)
- StackExchange.Redis (>= 3.1.13)
-
net8.0
- CasCap.Common.Abstractions (>= 4.12.4)
- CasCap.Common.Logging.Serilog (>= 4.12.4)
- CasCap.Common.Net (>= 4.12.4)
- CasCap.Common.Services (>= 4.12.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Exporter.Prometheus.AspNetCore (>= 1.15.3-beta.1)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Process (>= 1.15.1-beta.1)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- OpenTelemetry.Instrumentation.StackExchangeRedis (>= 1.15.1-beta.1)
- StackExchange.Redis (>= 3.1.13)
-
net9.0
- CasCap.Common.Abstractions (>= 4.12.4)
- CasCap.Common.Logging.Serilog (>= 4.12.4)
- CasCap.Common.Net (>= 4.12.4)
- CasCap.Common.Services (>= 4.12.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Exporter.Prometheus.AspNetCore (>= 1.15.3-beta.1)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Process (>= 1.15.1-beta.1)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- OpenTelemetry.Instrumentation.StackExchangeRedis (>= 1.15.1-beta.1)
- StackExchange.Redis (>= 3.1.13)
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 |
|---|---|---|
| 4.12.5 | 0 | 8/20/2026 |
| 4.12.4 | 41 | 8/18/2026 |
| 4.12.3 | 85 | 7/15/2026 |
| 4.12.2 | 90 | 6/26/2026 |
| 4.12.1 | 92 | 6/14/2026 |
| 4.12.0 | 88 | 6/12/2026 |
| 4.11.9 | 90 | 6/10/2026 |
| 4.11.8 | 174 | 5/27/2026 |
| 4.11.7 | 85 | 5/27/2026 |
| 4.11.6 | 86 | 5/26/2026 |
| 4.11.5 | 93 | 5/22/2026 |
| 4.11.4 | 115 | 5/20/2026 |
| 4.11.3 | 232 | 5/13/2026 |
| 4.11.2 | 100 | 5/11/2026 |
| 4.11.1 | 78 | 5/11/2026 |
| 4.11.0 | 127 | 5/8/2026 |
| 4.10.5 | 73 | 5/4/2026 |