observability-and-instrumentation

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

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Kunj-Sharma03/agent-contextify --skill observability-and-instrumentation-kunj-sharma03
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: observability-and-instrumentation
Source: https://github.com/Kunj-Sharma03/agent-contextify/tree/main/templates/skills/observability-and-instrumentation
Command: npx skills add https://github.com/Kunj-Sharma03/agent-contextify --skill observability-and-instrumentation-kunj-sharma03

SYSTEM DOCUMENTATION & REQUIREMENTS

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 development so production behavior is visible, queryable, and diagnosable. ## Core Features & Use Cases - Structured Logging: Enforces JSON log events with stable event names, consistent log levels, mandatory correlation IDs, and strict rules against logging secrets or PII. - Metrics and Tracing: Applies RED/USE metric patterns with bounded label cardinality, histogram-based latency percentiles, and OpenTelemetry distributed tracing with context propagation. - Symptom-Based Alerting: Designs actionable alerts tied to user-facing symptoms with runbook links, plus a verification process that test-fires alerts and validates telemetry end-to-end. - Use Case: When adding a payment retry flow with external provider calls, use this Skill to define on-call questions, emit structured payment_failed events, add RED metrics for the provider, and create an alert on error rate with a runbook. ## Quick Start Ask the agent to instrument your new production endpoint with structured logging, RED metrics, tracing, and a symptom-based alert using this observability skill.

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?

Emit JSON log events with stable event names and machine-readable fields instead of string interpolation. Attach a correlation ID via a child logger per request, and use consistent levels: error for broken invariants, warn for handled degradation, info for business events.

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 so p95 and p99 are queryable, and keep label cardinality bounded to route templates and status classes.

How do I set up distributed tracing with OpenTelemetry?

Initialize the OpenTelemetry NodeSDK with auto-instrumentations before any other imports to cover HTTP, gRPC, and common database clients. Add manual spans around meaningful internal work and propagate context across async boundaries like queues.

Why should I avoid user IDs as metric labels?

High-cardinality labels like user IDs, raw URLs, or error messages create a separate time series per unique value, which can overwhelm the metrics backend. Put unbounded values in logs and traces instead, and keep labels to small fixed sets.

When should I alert on symptoms instead of causes?

Alert on user-facing symptoms like error rate above 1% or p99 latency over 2 seconds, since cause-based alerts like CPU usage fire when nothing is wrong and miss unpredicted failures. Every alert must be actionable, link a runbook, and have a justified threshold.