Skip to content

– BACKEND: Add request‑id middleware & structured logging #946

Description

@OSEH-svg

Description
Log entries currently lack a correlation ID, making tracing across services difficult.

Goal
Generate a X-Request-Id header for each incoming request (or use the inbound header if present) and include it in all tracing logs.

Tasks

  1. Create a middleware that checks for X-Request-Id; if missing, generate a UUID and add it to the request extensions and response headers.
  2. Configure tracing to include the request ID in each span (%{request_id} field).
  3. Ensure errors and panics log the request ID.
  4. Add a unit test confirming the header propagation.

Acceptance Criteria

  • Every request receives a unique ID visible in logs and response headers.
  • Correlated log entries can be filtered by request ID.

Dependencies
Depends on: None
Blocks: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions