Agent skill · data analytics · wshobson
python-observability
Python observability patterns including structured logging, metrics, and distributed tracing. Use when adding logging, implementing metrics collection, setting up tracing, or debugging production systems.
Why this skill is useful
Provides specific patterns and code snippets for structured logging, metrics collection, and tracing that enhance observability in Python applications.
What it needs
Requires structlog installed locally. About 3k tokens when loaded. Last updated 2026-08-05. 38,570 stars on the source repository.
What this skill does
Python Observability Instrument Python applications with structured logs, metrics, and traces. When something breaks in production, you need to answer "what, where, and why" without deploying new code. When to Use This Skill Adding structured logging to applications Implementing metrics collection with Prometheus Setting up distributed tracing across services Propagating correlation IDs through request chains Debugging production issues Building observability dashboards Core Concepts 1. Structured Logging Emit logs as JSON with consistent fields for production environments. Machine-readable logs enable powerful queries and alerts. For local development, consider human-readable formats. 2. The Four Golden Signals Track latency, traffic, errors, and saturation for every service boundary. 3. Correlation IDs Thread a unique ID through all logs and spans for a single request, enabling end-to-end tracing. 4. Bounded Cardinality Keep metric label values bounded. Unbounded labels (like user IDs) explode storage costs. Quick Start Fundamental Patterns Pattern 1: Structured Logging with Structlog Configure structlog for JSON output with consistent fields. Pattern 2: Consistent Log Fields Every log entry should include standard fields for filtering and correlation. Pattern 3: Semantic Log Levels Use log levels consistently across the application. Level Purpose Examples ------- --------- ---------- DEBUG Development diagnostics Variable values, internal state INFO Request lifecycle, operations Request start/end, job completion WARNING Recoverable anomalies Retry attempts, fallback used ERROR Failures needing attention Exceptions, service unavailable Never log expected behavior at ERROR. A user entering a wrong password is INFO, not ERROR. Pattern 4: Correlation ID Propagation Generate a unique ID at ingress and thread it through all operations. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills wshobson/python-observability