python-observability

Instrument Python applications with structured logging, metrics, and distributed tracing.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sadroad/.dotfiles --skill python-observability-sadroad
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-observability
Source: https://github.com/sadroad/.dotfiles/tree/main/modules/home-manager/opencode/skills/python-observability
Command: npx skills add https://github.com/sadroad/.dotfiles --skill python-observability-sadroad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires structlog, prometheus_client, opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers instrument their Python applications to gain deep insights into their behavior in production, enabling faster debugging and performance optimization without requiring code changes.

Core Features & Use Cases

  • Structured Logging: Implement machine-readable JSON logs with consistent fields.
  • Metrics Collection: Integrate with systems like Prometheus using the Four Golden Signals.
  • Distributed Tracing: Set up end-to-end request tracing across microservices.
  • Use Case: When a critical API endpoint starts experiencing high latency, use this Skill to analyze logs for errors, check request rates and saturation metrics, and trace the request flow to pinpoint the bottleneck.

Quick Start

Configure structlog for JSON output with consistent fields by running the provided Python code snippet.

Frequently Asked Questions about python-observability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured logging in a Python application?

Structured logging in Python uses structlog to output machine-readable JSON logs with consistent fields. This provides consistent formatting for real-time system monitoring and faster debugging in production environments.

What is the best way to collect Prometheus metrics for Python microservices?

Collecting Prometheus metrics in Python uses prometheus_client to track the Four Golden Signals. This monitors request rates, latency, errors, and saturation for effective performance analysis.

How do I set up distributed tracing across Python services?

Distributed tracing across Python services uses OpenTelemetry to provide end-to-end request tracing. This traces request flow across microservices to pinpoint bottlenecks and analyze performance.

Can I use OpenTelemetry and structlog together for Python observability?

OpenTelemetry and structlog work together for Python observability by combining distributed tracing with structured logging. This uses correlation IDs to link traces and logs for unified debugging.

How do I debug high API latency using Python observability patterns?

Debugging high API latency uses Python observability patterns to analyze structured logs for errors, check saturation metrics, and trace request flows. This pinpoints bottlenecks in production environments.

What are the Four Golden Signals of observability in Python monitoring?

The Four Golden Signals in Python monitoring are latency, traffic, errors, and saturation. Implementing these best practices with prometheus_client ensures effective observability and bounded cardinality.