ISC.Observability 1.7.0

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

ISC.Observability SDK

Standard Observability SDK for .NET 6 / .NET 7 / .NET 8 microservices. One line of code wires up structured logging, distributed tracing, and metrics (OpenTelemetry + Serilog) to the central OTel Collector — no sink configuration, no boilerplate.

Features

  • Multi-targeting — net6.0, net7.0, net8.0. Supports WebApplicationBuilder, IHostApplicationBuilder, and IServiceCollection/Startup.cs.
  • Tracing — automatic W3C trace context propagation across HTTP in/out, with a composite W3C + B3 + Baggage propagator for Istio/Envoy service meshes.
  • Structured logging — Serilog, 100% snake_case JSON fields, trace_id/span_id auto-attached to every log line.
  • Global exception handling — unhandled exceptions are caught, logged at ERROR with full stack trace, and marked on the active span.
  • PII masking — sensitive fields (password, token, email, phone, card number...) are masked automatically before any log leaves the process. Zero-allocation (cached per property name).
  • Business event routing to Kafka — mark a log as a business event and pick its destination Kafka topic from code; the OTel Collector does the actual routing (see Business Event Logging).
  • Runtime & HTTP metrics — RPS, latency, error rate, CPU/RAM, GC, ThreadPool.
  • OTLP-only egress — the SDK never writes to a file, Kafka, or Elasticsearch directly. Everything goes out over OTLP to the Collector.

Supported instrumentations

All opt-in except HTTP and EF Core, toggled via config — no code changes required.

Instrumentation Config flag Default
ASP.NET Core + HttpClient — always on
Entity Framework Core (SQL Server, Postgres, MySQL...) Otel:EnableEntityFramework true
Redis (StackExchange.Redis) Otel:EnableRedis false
MongoDB Otel:EnableMongo false
Message brokers (MassTransit / Kafka / RabbitMQ) Otel:EnableMassTransit false
Quartz.NET background jobs Otel:EnableQuartz false
gRPC client Otel:EnableGrpc false

Installation

dotnet add package ISC.Observability

Remove any existing Serilog.Sinks.* packages (Console, File...) from the project — the SDK configures its own sinks and a second one will conflict.

Quick start

using ISC.Observability.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.AddStandardObservability("MyService");   // 1. logging + tracing + metrics

builder.Services.AddControllers();

var app = builder.Build();

app.UseStandardObservability();                  // 2. CorrelationId + GlobalException + request logging

app.MapHealthChecks("/health").SuppressRequestLogging();
app.MapHealthChecks("/ready").SuppressRequestLogging();

app.MapControllers();
app.Run();

Configuration

Everything below is read from appsettings.json / environment variables — no code changes.

OTLP endpoint — two ways to configure it:

// A) Full per-signal URL (recommended — matches ISC infra, port 80)
{
  "ServiceName": "Payment.Service",
  "ServiceNamespace": "payment-gateway",
  "ServiceVersion": "1.2.0",
  "OpenTelemetry": {
    "Logs":    "http://otel-collector.internal/v1/logs",
    "Tracing": "http://otel-collector.internal/v1/traces",
    "Metrics": "http://otel-collector.internal/v1/metrics"
  },
  "Otel": { "Protocol": "http", "EnableRedis": true, "EnableMongo": true }
}
// B) Base endpoint, SDK appends /v1/<signal> (backward-compatible with v1.3.x)
{
  "ServiceName": "Payment.Service",
  "ServiceNamespace": "payment-gateway",
  "Otel": {
    "OtlpHttpEndpoint": "http://otel-collector:4318",
    "Protocol": "http"
  }
}
Key Default Description
Otel:Protocol http http or grpc. Default http: ISC infra only opens OTLP/HTTP (port 80/4318).
OpenTelemetry:Logs/Tracing/Metrics — Full per-signal URL, path included. Highest priority; SDK does not append anything.
Otel:OtlpEndpoint http://localhost:4317 gRPC base (fallback, Protocol=grpc).
Otel:OtlpHttpEndpoint http://localhost:4318 HTTP base (fallback, Protocol=http); SDK appends /v1/<signal>.
OpenTelemetry:IngestionKey — Sent as Authorization: Bearer <key> header, if set.
Otel:TracesSampler always_on always_on | always_off | parentbased | a ratio 0.0-1.0.
Otel:CustomSources — Comma-separated ActivitySource names. Empty → wildcard * (capture everything).
Otel:Enable{Redis,Mongo,MassTransit,Grpc,Quartz,EntityFramework} see table above Per-instrumentation toggle.
ServiceNamespace — service.namespace (project grouping key). Used only when OTEL_RESOURCE_ATTRIBUTES doesn't set it. A WARN is logged at startup if neither source sets it.

Resource attributes: the SDK never overwrites the source

Each resource attribute belongs to whoever sets it. The SDK carries the value through unchanged: it doesn't lowercase or rename it, and it doesn't fill in a default. If a value is wrong, the owner fixes it at the source.

Attribute Source (in priority order) Owner
deployment.environment 1. OTEL_RESOURCE_ATTRIBUTES 2. fallback ASPNETCORE_ENVIRONMENT as-is Infra / DevOps
service.namespace 1. OTEL_RESOURCE_ATTRIBUTES 2. ServiceNamespace in appsettings (no fallback) DevOps / service owner
k8s.cluster.name and other infra attributes OTEL_RESOURCE_ATTRIBUTES or Collector processors Infra / DevOps

If a key is in OTEL_RESOURCE_ATTRIBUTES, the SDK does not set it again for traces, metrics or logs. If ServiceNamespace disagrees with OTEL_RESOURCE_ATTRIBUTES, the env value wins and the SDK logs a WARN.

# Example (k8s manifest env). Keep ASPNETCORE_ENVIRONMENT=Staging so appsettings.Staging.json still loads on Linux.
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=staging,service.namespace=econtract

Logging

Standard logging

Use ILogger<T> as usual — the SDK attaches trace_id, span_id, service_name, environment, correlation_id and masks PII automatically.

_logger.LogInformation("Processing order {order_id} for {customer_email}", order.Id, order.Email);
// customer_email is masked in the emitted log ("n***@g***.com") — PiiMaskingEnricher runs on every event.

Field naming (R-OBS-FIELD-001): every property is snake_case — system fields (service_name, trace_id, request_id...) and business fields alike (order_id, customer_name, total_amount). No PascalCase, no camelCase.

Business event logging (Kafka routing)

Mark a log as a business event and name the Kafka topic it should go to — the SDK never touches Kafka directly; it only tags the log, and the OTel Collector does the actual routing.

using ISC.Observability.Logging;

using (BusinessLog.Begin("order-events"))
{
    _logger.LogInformation(
        "Order {order_id} processed successfully, amount {total_amount}",
        order.Id, order.TotalAmount);
}

Everything logged inside the using block gets two extra fields: log_category=business and kafka_topic=order-events. Exit the block (or Dispose()) and subsequent logs are untagged again.

Requires SDK v1.6.0+. Three things to know:

  1. The topic name must exist as a declared route on the OTel Collector (otel-collector-config.yml, owned by DevOps). An undeclared/misspelled topic is never silently lost — the log just stays in Elasticsearch/Kibana as a safety net instead of reaching Kafka.
  2. Routing is exclusive, not dual-write: once a topic is declared, matching logs are removed from the Elasticsearch pipeline entirely — they are no longer searchable in Kibana by trace_id, only consumable from Kafka.
  3. Wrap only the specific log line(s) that are the actual business event — don't leave the scope open across a whole request, or unrelated technical logs will get tagged too.

See the project root README.md and otel-collector-config.yml for how DevOps wires a topic route (this package has no control over broker addresses, clusters, or Collector config).

Noise filtering

Third-party libraries (EF Core, HttpClient, Hangfire...) log a lot at Information. Override per namespace in appsettings.json (since v1.0.5):

{
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft.EntityFrameworkCore": "Warning",
        "System.Net.Http.HttpClient": "Warning",
        "MassTransit": "Warning"
      }
    }
  }
}

For anything a namespace override can't express (e.g. filtering by EventId), pass a callback:

builder.AddStandardObservability("MyService", loggerConfig =>
{
    loggerConfig.Filter.ByExcluding(e =>
        e.Properties.TryGetValue("EventId", out var id) && id.ToString().Contains("ExecutionAttempt"));
});

Suppressing noisy endpoints

Use .SuppressRequestLogging() on any endpoint (not just health checks) to downgrade its request log to Verbose — it disappears from Kibana/Console, but errors on it are never suppressed: HTTP ≥ 500 or an exception always logs at Error regardless.

app.MapHealthChecks("/health").SuppressRequestLogging();
app.MapGet("/internal/ping", () => "pong").SuppressRequestLogging();

This is a type-safe endpoint metadata marker, not a URL string match — zero allocation per request (benchmarked at 0 bytes vs. 40 bytes/request for the old URL-filter approach).

Console sink

Environment Console sink Format
Development / Local On by default Plain text
Production / Staging / other Off by default — (OTel sink already covers it)

Override either way via config:

{ "Serilog": { "Console": { "Enabled": true, "RestrictedToMinimumLevel": "Warning" } } }

No direct external sinks. The SDK's only egress is OTLP to the Collector — never configure WriteTo.Kafka(), WriteTo.Elasticsearch(), or WriteTo.File() in application code. The sanctioned way to get a log into Kafka is BusinessLog.Begin(...) above, routed by the Collector — not a sink in your code.

Custom spans

For a business-logic function worth its own entry in the Kibana APM waterfall:

private static readonly ActivitySource MyActivitySource = new("Payment.Service");

public void ProcessLargeData()
{
    using var activity = MyActivitySource.StartActivity("ProcessLargeData.CalculateHash");
    activity?.SetTag("data.size", "150MB");

    try
    {
        // ...
        activity?.SetStatus(ActivityStatusCode.Ok);
    }
    catch (Exception ex)
    {
        activity?.SetStatus(ActivityStatusCode.Error, ex.Message);
        activity?.AddException(ex);   // .NET 8+. On .NET 6/7: activity?.RecordException(ex) (using OpenTelemetry.Trace)
        throw;
    }
}

No extra package needed — System.Diagnostics is built into .NET.

Error reporting on spans

The SDK records an exception automatically only when it is unhandled, meaning it reaches UseStandardObservability(). When your own middleware, filter or try/catch catches the exception and returns a response, the SDK never sees it. In that case your code has to put the error on the span itself. The SDK carries whatever you set through unchanged.

What When Who sets it
Exception (exception.type, exception.message, exception.stacktrace) System errors, HTTP 5xx only Your exception handler
error.code tag Business errors, using the code from your error catalog (e.g. INVALID_OTP) The place that builds the error response

System error (5xx): record the exception in your own handler.

using System.Diagnostics;

catch (Exception ex)   // inside your exception middleware / filter
{
    var activity = Activity.Current;
    activity?.SetStatus(ActivityStatusCode.Error, ex.Message);
    activity?.AddException(ex);          // .NET 8+
    // .NET 6/7: activity?.RecordException(ex);   (using OpenTelemetry.Trace)

    context.Response.StatusCode = 500;
    // ... write the error response
}

Business error (4xx): tag error.code, do NOT record an exception or set Error status. Recording 4xx makes the error rate on the shared SigNoz dashboards meaningless.

public static ApiResponse BusinessError(string code, string message)
{
    Activity.Current?.SetTag("error.code", code);   // e.g. "INVALID_OTP"
    return new ApiResponse { /* ... code, message ... */ };
}

Put the tag in the shared factory that builds business errors (one place per service) so you don't have to add it at every call site. Logging an error_code property only adds it to the log record, not to the span.

QA compliance signal

On successful startup, the SDK emits a log line and the observability.sdk.active metric. The QA Compliance Tracker dashboard uses this to confirm a service is integrated before it's allowed to release to Production.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.7.0 173 11/19/2026
1.6.1 670 10/28/2026
1.6.0 83 10/28/2026
1.5.0 1,639 9/30/2026
1.4.3 81 9/22/2026
1.4.2 232 9/18/2026
1.4.1 135 8/26/2026
1.4.0 97 8/26/2026
1.3.2 149 8/2/2026
1.3.1 97 7/30/2026
1.3.0 88 7/30/2026
1.2.2 87 7/13/2026
1.2.1 82 7/13/2026
1.2.0 85 7/13/2026
1.1.1 127 7/7/2026
1.1.0 91 7/7/2026
1.0.17 85 7/7/2026
1.0.16 102 7/7/2026
1.0.15 81 7/7/2026
1.0.14 82 7/7/2026
Loading failed