observability-and-instrumentation

Implements structured logging, metrics, tracing, and alerting for production code.

2|Updated Jul 25, 2026
One-click install
npx skills add https://github.com/ankaboot-source/boucle --skill observability-and-instrumentation-ankaboot-source
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: observability-and-instrumentation
Source: https://github.com/ankaboot-source/boucle/tree/main/.jcode/skills/observability-and-instrumentation
Command: npx skills add https://github.com/ankaboot-source/boucle --skill observability-and-instrumentation-ankaboot-source

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Production features often ship without telemetry, so when something breaks you cannot tell what happened from the available data. This Skill guides you to instrument code alongside the feature so incidents become queries instead of archaeology. ## Core Features & Use Cases - Structured Logging: Emits JSON log events with stable event names, consistent log levels, and mandatory correlation/request IDs propagated across services. - Metrics with RED/USE: Adds rate, error, and duration histograms for endpoints and external dependencies, with strict label cardinality rules to protect the metrics backend. - Distributed Tracing & Alerting: Sets up OpenTelemetry auto-instrumentation with context propagation, plus symptom-based alerts that link to runbooks and are test-fired before launch. - Use Case: When adding a payment retry flow, define the on-call questions first, then emit a payment_failed structured event, a provider latency histogram, and a trace span per attempt so a single failing checkout can be diagnosed end-to-end. ## Quick Start Instrument the new checkout endpoint with structured logs, RED metrics, and an OpenTelemetry trace, then verify the telemetry by forcing an error in staging.

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?

Use a JSON logger that emits stable event names with machine-readable fields instead of string interpolation. Create a child logger per request carrying a request ID, and attach that ID to every log line, span, and outbound call.

What metrics should I track for an HTTP API?

Track RED metrics on every endpoint and external dependency: rate, errors, and duration as a histogram with p50/p95/p99 percentiles. Keep labels to small fixed sets like route template and status class, never user IDs or raw URLs.

How do I set up distributed tracing with OpenTelemetry?

Import the OpenTelemetry NodeSDK with auto-instrumentations before any other module so HTTP, gRPC, and database clients are traced automatically. Add manual spans only around meaningful internal work and propagate context across async boundaries.

Should I alert on CPU usage or error rates?

Alert on symptoms users feel, such as error rate above 1% or p99 latency over 2 seconds, not causes like CPU. Cause-based alerts fire when nothing is wrong and miss unpredicted failures; causes belong on dashboards.

Why is using user ID as a metric label a problem?

Every unique label combination creates a separate time series, so unbounded values like user IDs or request IDs cause cardinality explosions that overwhelm the metrics backend. High-cardinality lookups belong in logs and traces instead.

When should I not use this instrumentation approach?

Do not use it to diagnose an active failure, which belongs to debugging workflows, or to profile measured slowness, which belongs to performance optimization. Instrumentation is written alongside the feature to make future diagnosis fast.