Wicrypt.Telemetry.OpenTelemetry 1.0.1

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

Wicrypt.Telemetry.OpenTelemetry

An opinionated OpenTelemetry package for Wicrypt ASP.NET Core services. It configures:

  • OTLP export for distributed traces and logs
  • ASP.NET Core, HTTP client, Entity Framework Core, SQL Client, Redis, and runtime instrumentation
  • Prometheus metrics at /metrics
  • structured JSON console logs with trace correlation
  • sampled HTTP request logs with sensitive-field redaction

Installation

dotnet add package Wicrypt.Telemetry.OpenTelemetry

Configuration

{
  "OpenTelemetry": {
    "Endpoint": "http://otel-collector:4317",
    "ServiceName": "Wicrypt.DeviceAPI",
    "RequestLogging": {
      "CaptureBodiesForSuccessfulRequests": false,
      "SuccessfulRequestSampleRate": 0.1
    }
  }
}

OpenTelemetry:Endpoint is required and must be an absolute OTLP/gRPC endpoint. ServiceName is optional; the entry assembly name is used when it is omitted. Successful-request body capture is disabled by default, and its sample rate must be between 0 and 1. Failed requests are always logged with capturable JSON bodies.

Usage

using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using Wicrypt.Telemetry.OpenTelemetry;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

builder.AddWicryptOpenTelemetry(openTelemetry =>
    openTelemetry
        .WithMetrics(metrics => metrics
            .AddMeter(FeeSettlementTelemetry.MeterName))
        .WithTracing(tracing => tracing
            .AddSource(MessageTelemetry.ActivitySourceName)));

WebApplication app = builder.Build();

app.MapOpenTelemetryMetrics();

app.Run();

Health endpoints under /health and the /metrics endpoint are excluded from request tracing and request logging.

The package does not assume application-specific meter or activity-source names. Each client registers its own sources through the configuration callback. The callback also accepts any other MeterProviderBuilder or TracerProviderBuilder customization supported by OpenTelemetry.

Development

dotnet restore Wicrypt.Telemetry.OpenTelemetry.slnx
dotnet build Wicrypt.Telemetry.OpenTelemetry.slnx -c Release --no-restore
dotnet test Wicrypt.Telemetry.OpenTelemetry.slnx -c Release --no-build
dotnet pack src/Wicrypt.Telemetry.OpenTelemetry -c Release --no-build

Package versions are generated by Nerdbank.GitVersioning from version.json. The GitLab pipeline builds and tests every change, then packs and publishes main-branch changes to NuGet.org using NUGET_API_KEY.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
1.0.6 171 9/14/2026
1.0.4 97 9/12/2026
1.0.3 63 9/12/2026
1.0.2 61 9/12/2026
1.0.1 59 9/12/2026