observability-and-instrumentation

Instruments production code with structured logging, metrics, tracing, and alerting for diagnosability.

113k|11.8k|Updated Feb 15, 2026
Ready to run
npx skills add https://github.com/addyosmani/agent-skills --skill observability-and-instrumentation-addyosmani
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: observability-and-instrumentation
Source: https://github.com/addyosmani/agent-skills/tree/main/skills/observability-and-instrumentation
Command: npx skills add https://github.com/addyosmani/agent-skills --skill observability-and-instrumentation-addyosmani

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Production incidents that take hours to diagnose because the system produces no useful telemetry. When failures happen, on-call engineers have no logs to query, no metrics to correlate, and no traces to follow. This Skill ensures code emits the signals needed to answer critical questions immediately: what failed, why, and where across services. ## Core Features & Use Cases - Structured Logging: JSON event logs with stable names, correlation IDs, and entry-point attribution so each request can be reconstructed from interleaved logs. - RED Metrics: Rate, errors, and duration histograms (not averages) on every endpoint and external dependency with bounded label sets. - Distributed Tracing: OpenTelemetry integration with auto-instrumentation for cross-service visibility without manual span code. - Symptom-Based Alerting: Alerts on user-facing conditions (error rate, latency), not infrastructure causes, with runbooks linked to every page. - Use Case: A checkout payment retry fails in production. Without instrumentation, you spend two hours reading logs and running database queries. With this Skill applied: you query the structured payment_failed event by requestId, see the provider error code, check the p99 latency metric, trace the slow hop in the cross-service call, and page the database team—all in five minutes. ## Quick Start When adding a new production feature with retries or external calls, define the on-call questions first, then instrument structured logs with correlation IDs, RED metrics with bounded labels, OpenTelemetry traces, and symptom-based alerts with runbook links.

Frequently Asked Questions about observability-and-instrumentation

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

FAQPage Schema
How do I structure logs so they are queryable in production?▼

Emit JSON objects with a stable event name and machine-readable fields instead of string interpolation. Attach a correlation ID (request ID) to every log line so a single request can be reconstructed across services. Use log levels consistently: error for invariant breaks, warn for degraded-but-handled states, info for business events.

What metrics should I track for every endpoint?▼

Track RED: Rate (requests per second), Errors (failure rate as a percentage), Duration (latency histogram with p50/p95/p99, never averages). Use bounded label sets only—never user IDs, URLs, or error messages as labels or you will crash the metrics backend with cardinality explosion.

How do I trace a request across multiple services?▼

Use OpenTelemetry with auto-instrumentation enabled; it covers HTTP, gRPC, and database calls with zero manual code. Propagate the trace context in HTTP headers and queue metadata across every service boundary. Auto-instrumentation will capture spans; add manual spans only around meaningful internal units of work like chargeProvider.

Why should alerts page on symptoms, not infrastructure metrics?▼

Symptom alerts (error rate > 1%, latency > 2s) fire exactly when users are hurt. Cause alerts (CPU at 85%, disk at 70%) fire constantly when nothing is wrong and miss failures you didn't predict. On-call ignores noisy alerts; design every page around something a user felt.

What goes in a runbook and how detailed should it be?▼

A runbook must answer three questions without requiring the reader to think: what is happening, what to check first, and who to escalate to. A three-line runbook beats a twenty-line document. Add steps only when the first check alone is not enough to decide. Keep runbooks current—update them after closing every incident that used them.

How do I prevent secrets and PII from leaking in telemetry?▼

Allowlist fields; never log whole request bodies. Avoid logging user IDs, passwords, API tokens, or unredacted email addresses. Strip sensitive values before emitting, and configure your logging library to audit what was redacted for security review.