python-observability

Implement Python structured logging, metrics, and distributed tracing with structlog and OpenTelemetry.

2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/yashvinthan/DuskSpendr --skill python-observability-yashvinthan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-observability
Source: https://github.com/yashvinthan/DuskSpendr/tree/main/.agents/skills/python-observability
Command: npx skills add https://github.com/yashvinthan/DuskSpendr --skill python-observability-yashvinthan

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 addresses the challenge of understanding and debugging Python applications in production by providing tools and patterns for structured logging, metrics collection, and distributed tracing.

Core Features & Use Cases

  • Structured Logging: Implement JSON-formatted logs for easier parsing and analysis.
  • Metrics Collection: Integrate with systems like Prometheus to track key performance indicators (The Four Golden Signals).
  • Distributed Tracing: Set up correlation IDs and use OpenTelemetry to trace requests across services.
  • Use Case: Debugging a slow API endpoint by analyzing logs, metrics, and traces 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 Python for easier production debugging?

Set up distributed tracing in Python using OpenTelemetry and correlation IDs to trace requests across services. This approach pinpoints bottlenecks in slow API endpoints by analyzing distributed traces alongside logs and metrics.

How do I collect Prometheus metrics in Python to track the Four Golden Signals?

Collect Prometheus metrics in Python using the prometheus_client library to track key performance indicators like the Four Golden Signals. This integration monitors application performance and identifies bottlenecks in production systems.

Does OpenTelemetry work with structlog for Python observability?

OpenTelemetry works with structlog for Python observability by combining distributed tracing with structured JSON logging. Using both libraries provides correlated logs and traces, enabling comprehensive visibility into application behavior across services.

What is the best way to debug a slow Python API endpoint using observability patterns?

Debug a slow Python API endpoint by combining structured logs, Prometheus metrics, and OpenTelemetry distributed traces. Analyzing these observability signals together pinpoints performance bottlenecks and provides clear visibility into application behavior.

Do I need opentelemetry-sdk and opentelemetry-exporter-otlp to set up Python distributed tracing?

You need opentelemetry-sdk and opentelemetry-exporter-otlp to set up Python distributed tracing and export telemetry data. These dependencies provide the necessary SDK configuration and OTLP export protocol functionality for collecting traces across services.