Skip to content

Observability: activate the telemetry pipeline — OTLP trace export, request logging, TraceId↔log correlation #214

Closed

Description

@mforce

What to build

OpenTelemetry tracing is already configured in the API (ASP.NET Core + EF Core instrumentation, service name Cluckwork.Api) but no exporter is registered, so every span is created and then dropped. Serilog writes console logs, but no per-request line is emitted in production (the Microsoft → Warning level override suppresses hosting logs), and log lines carry no trace identifiers, so logs and traces cannot be joined.

Make the existing telemetry real, end to end:

  • Export traces via OTLP, with endpoint/headers coming from configuration. Unset endpoint = exporter off; current local-dev behavior preserved.
  • Emit one structured log line per request (method, path, status code, elapsed ms) via Serilog request logging.
  • Include TraceId/SpanId in log output so a log line can be joined to its exported trace.

Prefer the framework/library facilities (Serilog request logging, OTel OTLP exporter package) over anything hand-rolled.

Acceptance criteria

  • With an OTLP endpoint configured, request and EF Core spans arrive at a collector; with it unset, the app boots and runs exactly as today
  • Every API request produces one structured log line with method, path, status code, and elapsed ms
  • Health-probe requests (/health/live, /health/ready) don't flood the request log at Information level
  • Log output includes TraceId/SpanId matching the exported spans
  • deploy/.env.example documents the new OTLP settings with placeholders only (no real values)
  • Build clean (warnings are errors); existing test suite green

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions