observability-and-instrumentation

Instruments production code with structured logs, metrics, traces, and symptom-based alerts.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill observability-and-instrumentation-qiuyi-hong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: observability-and-instrumentation
Source: https://github.com/Qiuyi-Hong/addyosmani-skills/tree/main/skills/observability-and-instrumentation
Command: npx skills add https://github.com/Qiuyi-Hong/addyosmani-skills --skill observability-and-instrumentation-qiuyi-hong

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @opentelemetry/sdk-node, @opentelemetry/auto-instrumentations-node, prom-client.

What problem does it solve? Production features often ship without telemetry, so when incidents occur engineers cannot tell what happened from the available data. This Skill guides you to instrument code alongside the feature so on-call questions can be answered from logs, metrics, and traces instead of guesswork. ## Core Features & Use Cases - Structured Logging: Emits JSON log events with stable event names, correlation IDs, and entry-point fields, while keeping secrets and PII out of log pipelines. - Metrics and Tracing: Applies RED/USE metrics with bounded label cardinality and OpenTelemetry distributed tracing with context propagation across services. - Alerting and Runbooks: Defines symptom-based alerts with thresholds, severities, and linked runbooks, plus a verification pass that test-fires alerts and traces requests end-to-end. - Use Case: When adding a payment retry flow, use this Skill to define the on-call questions, add structured payment_failed log events, RED metrics on the provider calls, and an alert on elevated failure rate with a runbook link. ## Quick Start Instrument my new checkout endpoint with structured logging, RED metrics, OpenTelemetry tracing, and a symptom-based alert with a runbook.

Frequently Asked Questions about observability-and-instrumentation

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

FAQPage Schema
How do I add structured logging to a Node.js application?

Structured logging emits JSON objects with a stable event name and machine-readable fields instead of interpolated strings. Attach a child logger with a request ID per request so every line can be correlated, and never log secrets or full request bodies.

What metrics should I track for an HTTP API?

Use the RED method: rate, errors, and duration for every endpoint and external dependency. Track latency as a histogram with p50/p95/p99 percentiles rather than averages, and keep label values from small fixed sets to avoid cardinality explosions.

How do I set up distributed tracing with OpenTelemetry?

Initialize the OpenTelemetry NodeSDK with auto-instrumentations before importing anything else, which covers HTTP, gRPC, and common database clients. Add manual spans around meaningful internal work and propagate context across HTTP headers and queue metadata.

Why should alerts be symptom-based instead of cause-based?

Symptom-based alerts fire exactly when users are hurt, such as error rate above 1% or p99 latency over 2 seconds, regardless of cause. Cause-based alerts like CPU thresholds fire when nothing is wrong and miss failures you did not predict.

When should I not use this observability skill?

Do not use it to diagnose an active failure; use a debugging skill for that. It also does not cover performance profiling of measured slowness or launch-day monitoring checklists, which belong to performance-optimization and shipping workflows.