Python observability that holds up in production
Field-tested guides for backend engineers, SREs, and platform teams: structured logging, context-safe trace propagation, Prometheus and OpenTelemetry metrics, the pipelines that deliver all three, and the profiling that explains why a service is slow.
Every area opens with an architecture overview, then drills into focused implementation guides — exception capture and redaction, log schemas, collector topology and delivery guarantees, telemetry cost, SLOs and burn-rate alerts, flame graphs and memory leaks — each with runnable code and the output you should expect to see.
Explore the core topics
190 guides across six 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.
- Step 1 How to Configure Python Logging for Production A working baseline: levels, handlers, and a config that survives a restart under load.
- Step 2 Structured Logging with the Python Standard Library Zero-dependency JSON output your log backend can actually index and query.
- Step 3 structlog vs Loguru vs Standard Library Logging Pick a library on evidence — API surface, performance, and how each behaves in a service.
- Step 4 Setting Up OpenTelemetry in FastAPI Your first traced service, from SDK wiring to spans arriving at a collector.
- Step 5 Adding Trace IDs to Python Log Records The join key that turns separate logs and traces into one investigation.
- Step 6 OpenTelemetry vs Prometheus for Python Metrics Choose a metrics path before you instrument, not after the dashboards exist.
- 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.
- Burn-Rate Alerts and Error Budgets Page on how fast the objective is being spent, not on a fixed error rate.
- Reading Flame Graphs for Python Services Width is time; the widest plateau near the top is where to look.
- Tail Sampling in the OpenTelemetry Collector Keep every error and slow trace while storing a fraction of the rest.
- Tuning BatchSpanProcessor for Throughput The arithmetic that decides whether spans are quietly dropped.
- Prometheus Multiprocess Mode with Gunicorn Every worker counted, whichever one answers the scrape.
- Propagating Context Across Thread and Process Pools Where the trace breaks when work leaves the request's thread.
- Designing a Log Schema for a Service Fleet One set of field names, so one query works across every service.
- Preventing Log Injection in Python User input that forges log lines, and the formatter that stops it.
Start from the symptom
Six things that go wrong in a running Python service, and the page that explains what is actually happening.
- Memory climbs and never comes back Leak, fragmentation or cache — three causes with three different signatures.
- The service is slow and CPU is idle A blocked event loop serves nothing and reports no errors.
- Spans and metrics are going missing Every stage that can drop telemetry has a counter that says so.
- Counters jump around under Gunicorn Each scrape sees one worker's numbers until the workers are aggregated.
- The trace stops at one service Two propagation formats, one gateway allowlist, and how to tell which broke it.
- The telemetry bill doubled Find which signal and which service grew before cutting anything.
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.