CasCap.Common.OpenTelemetry 4.11.0

Prefix Reserved
dotnet add package CasCap.Common.OpenTelemetry --version 4.11.0
                    
NuGet\Install-Package CasCap.Common.OpenTelemetry -Version 4.11.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="CasCap.Common.OpenTelemetry" Version="4.11.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CasCap.Common.OpenTelemetry" Version="4.11.0" />
                    
Directory.Packages.props
<PackageReference Include="CasCap.Common.OpenTelemetry" />
                    
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 CasCap.Common.OpenTelemetry --version 4.11.0
                    
#r "nuget: CasCap.Common.OpenTelemetry, 4.11.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 CasCap.Common.OpenTelemetry@4.11.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=CasCap.Common.OpenTelemetry&version=4.11.0
                    
Install as a Cake Addin
#tool nuget:?package=CasCap.Common.OpenTelemetry&version=4.11.0
                    
Install as a Cake Tool

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

Behaviour

  • Skips registration when IMetricsConfig.OtlpExporterEndpoint is null — safe for development without an OTEL collector.
  • Development mode: Registers a Prometheus exporter for local /metrics scraping.
  • 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> and Action<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 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. 
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
4.11.0 5 5/8/2026
4.10.5 47 5/4/2026