Skip to content

feat: observability setup (OTel SDK, OTLP exporter, structured logging, span helpers) #19

@constk

Description

@constk

Problem

Distributed tracing has to be wired before the first feature ships, or instrumentation never gets retrofitted.

Proposed solution

Port src/observability/{logging.py, spans.py, tracing.py} from Teller. Tracing: OTel SDK + OTLP gRPC exporter pointed at OTEL_EXPORTER_OTLP_ENDPOINT (Jaeger via docker-compose). Logging: structured JSON logs correlated with active span ID. Span helpers: official OTel semantic-convention attribute names only (per feedback_otel_semconv memory). Wire FastAPI auto-instrumentation in src/api/main.py.

Acceptance criteria

  • Hitting /api/v1/health produces a span visible in Jaeger UI.
  • Logs are JSON, single-line, with trace_id and span_id fields.
  • tests/test_observability.py asserts span creation and semconv attribute names.
  • No custom-named OTel attributes; only semconv-defined ones.

Priority rationale

High: observability retrofitted is observability never done. Locks in correct tracing posture from day one.

Depends on

#17

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendPython + FastAPI backend scaffoldenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions