python-observability

Configure structured logging, Prometheus metrics, and OpenTelemetry tracing in Python apps.

2|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/NorkzYT/claude-code-autopilot --skill python-observability
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-observability
Source: https://github.com/NorkzYT/claude-code-autopilot/tree/main/.claude/skills/python-observability
Command: npx skills add https://github.com/NorkzYT/claude-code-autopilot --skill python-observability

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Python developers achieve end-to-end observability by providing structured logging, metrics, and distributed tracing, enabling faster diagnosis of production issues without invasive changes.

Core Features & Use Cases

  • Structured Logging: emit JSON logs with consistent fields for correlation and filtering.
  • Metrics & Tracing: collect Prometheus-compatible metrics and OpenTelemetry traces to monitor performance and service interactions.
  • Use Case: when debugging a running service, instrument code to capture request latency, errors, and throughput, and correlate across services.

Quick Start

Install and configure the recommended libraries (e.g., structlog, prometheus_client, and opentelemetry) and provide a minimal example to initialize logging, metrics, and tracing. Example (plain text): import logging import structlog from prometheus_client import start_http_server from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.exporter.otlp.proto.grpc.exporter import OTLPSpanExporter from opentelemetry.sdk.trace.export import BatchSpanProcessor

Initialize logging

structlog.configure(...) logging.basicConfig(level="INFO") logger = structlog.get_logger()

Start metrics server

start_http_server(8000)

Configure tracing

provider = TracerProvider() processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4317")) provider.add_span_processor(processor) trace.set_tracer_provider(provider) tracer = trace.get_tracer(name) logger.info("Observability initialized")

Frequently Asked Questions about python-observability

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

FAQPage Schema
How do I add structured logging, metrics, and tracing to a Python app?

Structured logging in Python emits JSON logs with consistent fields for correlation. Using libraries like structlog allows you to filter and debug running services by capturing request flows and errors effectively.

How does OpenTelemetry tracing work with Python services?

Python observability requires libraries like structlog, prometheus_client, and OpenTelemetry. You must install and configure these dependencies to initialize logging, start a metrics server, and set up trace exporters.

What is the best way to collect Prometheus metrics in Python?

Python observability instruments code across development, staging, and production environments. It diagnoses incidents and optimizes performance by tracing request flows and collecting metrics throughout the pipeline.

Why do I need distributed tracing to debug Python microservices?

Python observability supports staging and production environments by providing consistent instrumentation. It captures metrics and traces to diagnose incidents and optimize performance without requiring invasive changes.

Can I use standard logging instead of structlog for Python observability?

You can use standard logging instead of structlog for Python observability. The setup supports both standard logging and structlog to emit structured logs and initialize consistent fields for correlation.