CoreSystem.Observability 1.0.0

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

📊 CoreSystem.Observability

OpenTelemetry and Serilog integration for ASP.NET Core applications on .NET 8

CoreSystem.Observability configures structured logs, distributed traces, metrics, and health-check endpoints from a single WebApplicationBuilder extension. It exports telemetry through OTLP/gRPC and supports observability contributions registered by other CoreSystem modules.

NuGet Downloads License .NET OpenTelemetry


✨ Features

  • ✅ Serilog console logging with optional OTLP log export
  • ✅ ASP.NET Core, HTTP client, SQL Server, and runtime instrumentation
  • ✅ OTLP/gRPC export for traces, metrics, and logs
  • ✅ Configurable trace sampling
  • ✅ Optional SQL statement capture, disabled by default
  • ✅ Custom meters and activity sources contributed by CoreSystem modules
  • ✅ Liveness endpoint at /health
  • ✅ Readiness endpoint at /ready
  • ✅ Invalid or empty OTLP endpoints do not prevent the application from starting

📦 Installation

dotnet add package CoreSystem.Observability

🚀 Quick Start

Register observability before building the application:

var builder = WebApplication.CreateBuilder(args);

builder.AddObservability(
    environment: builder.Environment.EnvironmentName,
    serviceName: "Orders.Api",
    serviceNamespace: "Company.Platform");

var app = builder.Build();

app.UseObservabilityEndpoints();

app.Run();

UseObservabilityEndpoints() enables Serilog request logging and maps the health endpoints. Place it before endpoint mappings that should be included in request logging.


⚙️ Configuration

Configure telemetry in the OpenTelemetry section of appsettings.json. Each signal is disabled unless its Enabled property is true.

{
  "OpenTelemetry": {
    "Logging": {
      "Enabled": true,
      "OtlpEndpoint": "http://localhost:4317"
    },
    "Tracing": {
      "Enabled": true,
      "OtlpEndpoint": "http://localhost:4317",
      "SamplingProbability": 1.0,
      "CaptureSqlStatements": false
    },
    "Metrics": {
      "Enabled": true,
      "OtlpEndpoint": "http://localhost:4317",
      "Meters": [
        "Core.Idempotency",
        "Core.Resilience"
      ]
    }
  }
}

All three signals use OTLP over gRPC. The default endpoint is http://otel-collector:4317; provide an endpoint reachable from the running application. An empty or invalid endpoint skips that signal's exporter while leaving the application running.

Trace sampling

SamplingProbability must be between 0 and 1. Invalid values fall back to 1.0.

SQL statement capture

CaptureSqlStatements is false by default. SQL text can contain sensitive values, so enable it only after confirming your queries do not expose secrets or personally identifiable information.


🩺 Health Endpoints

Endpoint Purpose Registered checks
/health Liveness probe None; reports that the process can serve requests.
/ready Readiness probe All checks registered by IHealthCheckContributor implementations.

Both endpoints return JSON with the overall status, duration, and individual check details. The health and readiness endpoints are excluded from ASP.NET Core trace instrumentation to reduce telemetry noise.


📊 Telemetry

Traces

Tracing includes ASP.NET Core requests, outgoing HttpClient calls, and SQL Server client operations. Registered IObservabilityContributor implementations can add their activity source names to the trace provider.

Metrics

Metrics include ASP.NET Core, HttpClient, and .NET runtime instrumentation. Add application or CoreSystem meter names through OpenTelemetry:Metrics:Meters.

Logs

Logs use Serilog with console output by default. When logging is enabled and a valid OTLP endpoint is configured, logs are additionally exported through OTLP.


🔌 CoreSystem Integration

CoreSystem modules can contribute their own telemetry and health checks through the CoreSystem.Observability.Abstractions package. Register those modules before calling AddObservability so their contributors are included during observability setup.

builder.Services.AddCoreIdempotency(options =>
{
    // Configure the module.
});

builder.AddObservability(
    builder.Environment.EnvironmentName,
    "Orders.Api",
    "Company.Platform");

🛠 Requirements

Component Version
.NET SDK 8.0+
ASP.NET Core 8.0+
OTLP collector or compatible backend Recommended
OTLP gRPC endpoint Commonly port 4317

🤝 Contributing

Issues, discussions, and pull requests are welcome.


📄 License

Released under the MIT License.

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 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.1.0 75 10/24/2026
1.0.3 98 10/18/2026
1.0.2 162 10/12/2026
1.0.1 130 10/7/2026
1.0.0 219 9/18/2026