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.
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.
- 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.
- Exception and Traceback Logging in Python Tracebacks that arrive whole, structured, and free of secrets.
- Measuring asyncio Event Loop Lag One series that says whether the problem is inside the process.
- Tuning BatchSpanProcessor for Throughput The arithmetic that decides whether spans are quietly dropped.
- Choosing Histogram Buckets for Latency SLOs A boundary on the objective turns an estimate into a count.
- Non-Blocking Logging with QueueHandler Keep a slow sink from stalling request threads.
- Sampling Strategies for Distributed Tracing Head, tail, and parent-based sampling in practice.
- Controlling Label Cardinality in Prometheus Stop a label explosion before it takes out the store.
- Rate Limiting and Sampling Noisy Loggers Shed a burst at the source and keep an exact count of what went.
Start from the symptom
Six things that go wrong in a running Python service, and the page that explains what is actually happening.
- The trace stops at one service Two propagation formats, one gateway allowlist, and how to tell which broke it.
- Spans never reach the backend Three checks, in order, that each eliminate a whole branch.
- A dependency is flooding the log Find the real logger names, then quieten the one that matters.
- Memory climbs and never comes back The daily minimum, not the peak, is what separates a leak from growth.
- DEBUG is needed now, on one logger Change a level in a live process — with an expiry, so it cannot be forgotten.
- Secrets are reaching the log Four fields carry text, and the usual filter covers one of them.
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.