NowAround.SharedKernel.Observability 0.2.0-ci.235

NowAround.SharedKernel.Observability

Shared OpenTelemetry defaults for NowAround services.

The package centralizes tracing, metrics, logging, resource metadata, and OTLP exporter configuration so services can use the same observability baseline.

Usage

Register observability directly from a service:

builder.Services.AddNowAroundObservability(
    builder.Configuration,
    builder.Environment,
    "catalog-api");

ASP.NET Core applications that reference NowAround.SharedKernel.Api can use the convenience extension:

builder.AddOpenTelemetry("catalog-api");

AddNowAroundObservability also registers AddNowAroundCore(), which provides the shared correlation and application execution context services.

Configuration

Minimum local configuration:

{
  "OTLP_Endpoint": "http://localhost:4317"
}

Structured configuration:

{
  "NowAround": {
    "Observability": {
      "Enabled": true,
      "EnableTracing": true,
      "EnableMetrics": true,
      "EnableLogging": true,
      "ServiceNamespace": "NowAround",
      "ServiceVersion": "1.0.0",
      "EnvironmentName": "Development",
      "Team": "NowAround",
      "OtlpEndpoint": "http://localhost:4317",
      "OtlpProtocol": "Grpc",
      "OtlpHeaders": "api-key=local",
      "ExportTimeoutMilliseconds": 10000,
      "InstrumentAspNetCore": true,
      "InstrumentHttpClient": true,
      "InstrumentPostgresql": true,
      "InstrumentRuntime": true,
      "IncludeFormattedLogMessage": true,
      "IncludeLogScopes": true,
      "ParseLogStateValues": true,
      "ActivitySources": [
        "NowAround.Events.Infrastructure",
        "NowAround.Events.Infrastructure.RabbitMQ",
        "NowAround.Events.Infrastructure.MassTransit"
      ],
      "Meters": [
        "NowAround.DomainEvents",
        "NowAround.Outbox",
        "Microsoft.AspNetCore.Hosting",
        "Microsoft.AspNetCore.Server.Kestrel",
        "System.Net.Http"
      ],
      "ResourceAttributes": {
        "service.tier": "api"
      }
    }
  }
}

If NowAround:Observability:OtlpEndpoint is not configured, the package falls back to OTLP_Endpoint and then OTEL_EXPORTER_OTLP_ENDPOINT.

Defaults

  • Adds OpenTelemetry resource metadata with service name, namespace, version, team, and environment.
  • Enables ASP.NET Core, HttpClient, PostgreSQL, and runtime instrumentation by default.
  • Exports traces, metrics, and logs through OTLP when observability is enabled.
  • Includes formatted log messages, scopes, and parsed state values by default.
  • Validates options at startup so missing or invalid exporter settings fail early.

Correlation

Application correlation is carried by X-Correlation-Id. Distributed tracing remains W3C-based through traceparent and tracestate.

Use UseCorrelationId() from NowAround.SharedKernel.Api before endpoint execution. It adds correlation_id to the current activity and opens a logging/correlation scope for the request.

Showing the top 20 packages that depend on NowAround.SharedKernel.Observability.

Packages Downloads
NowAround.SharedKernel.Api
Shared middlewares
30
NowAround.SharedKernel.Events.Infrastructure
Infrastructure services for NowAround domain event dispatching and EF Core outbox integration event processing.
24
NowAround.SharedKernel.Api
Shared middlewares
11
NowAround.SharedKernel.Events.Infrastructure
Infrastructure services for NowAround domain event dispatching and EF Core outbox integration event processing.
11
NowAround.SharedKernel.Events.Infrastructure
Infrastructure services for NowAround domain event dispatching and EF Core outbox integration event processing.
7
NowAround.SharedKernel.Api
Shared middlewares
5
NowAround.SharedKernel.Events.Infrastructure
Infrastructure services for NowAround domain event dispatching and EF Core outbox integration event processing.
5
NowAround.SharedKernel.Api
Shared middlewares
3
NowAround.SharedKernel.Events.Infrastructure
Infrastructure services for NowAround domain event dispatching and EF Core outbox integration event processing.
3

Version Downloads Last updated
0.3.0 35 06/03/2026
0.2.1-ci.254 3 06/01/2026
0.2.0 11 06/01/2026
0.2.0-ci.235 5 05/30/2026
0.2.0-ci.218 11 05/26/2026