Logging · Tracing · Metrics

Python observability that holds up in production

Field-tested guides for backend engineers, SREs, and platform teams: structured logging, context-safe trace propagation, OpenTelemetry pipelines, and Prometheus metrics that scale under load.

Every area opens with an architecture overview, then drills into focused implementation guides — exception capture and redaction, logging overhead, exporters and the collector, cross-signal correlation, and the runtime metrics that say whether the problem is inside the process — each with runnable code and the output you should expect to see.

Python service Logs Traces Metrics OTel collector store

Explore the core topics

91 guides across four areas of the Python observability stack. Each area starts with the architecture decisions and operational constraints, then links to focused pages that take one pattern at a time.

Start here

New to the site? This is the shortest path from an unstructured print statement to logs, traces, and metrics that correlate.

  1. Step 1 How to Configure Python Logging for Production A working baseline: levels, handlers, and a config that survives a restart under load.
  2. Step 2 Structured Logging with the Python Standard Library Zero-dependency JSON output your log backend can actually index and query.
  3. Step 3 structlog vs Loguru vs Standard Library Logging Pick a library on evidence — API surface, performance, and how each behaves in a service.
  4. Step 4 Setting Up OpenTelemetry in FastAPI Your first traced service, from SDK wiring to spans arriving at a collector.
  5. Step 5 Adding Trace IDs to Python Log Records The join key that turns separate logs and traces into one investigation.
  6. Step 6 OpenTelemetry vs Prometheus for Python Metrics Choose a metrics path before you instrument, not after the dashboards exist.
  7. Step 7 Correlating Logs, Traces and Metrics The join keys that turn three separate streams into one investigation.

Go deeper

The guides readers come back to once the basics are running — the parts that tend to break first at scale.

Start from the symptom

Six things that go wrong in a running Python service, and the page that explains what is actually happening.

Every topic on the site

The full map, one column per area. Each link opens a topic overview with its own set of implementation guides.

Built for production, not demos

Runnable code

Every snippet pins version ranges and ships with an expected-output block — console logs or OTLP collector JSON.

Async-safe by default

Patterns for asyncio, context variables, thread pools, and process boundaries so context never fragments.

Cost-aware

Sampling strategies and label-cardinality control to keep telemetry useful without blowing up storage bills.

Cross-signal correlation

Tie logs, traces, and metrics together with shared resource attributes and injected trace IDs.