# API Observability Distributed Tracing

> Instrument REST APIs with structured JSON logs, RED/USE metrics, W3C Trace Context, X-Request-Id, and OpenTelemetry. Use when adding observability or correlating multi-service failures.

- Skill: `deangrant/api-observability-distributed-tracing` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add deangrant/api-observability-distributed-tracing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/deangrant/api-observability-distributed-tracing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: deangrant (https://skillmd.com/u/deangrant)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/deangrant/api-observability-distributed-tracing

---


# Observability and Distributed Tracing

Use this skill when making API behavior **debuggable in production**.

---

## 1. Logs

Structured JSON: method, path, status, duration; honor/propagate
`X-Request-Id` / correlation ID; echo in response. No secrets/PII.

---

## 2. Metrics

**RED:** rate, errors, duration percentiles. **USE** on dependencies. Alert on
error rate + p99.

---

## 3. Traces

W3C `traceparent`/`tracestate` on internal calls; OpenTelemetry instrumentation.
One wide contextual event per request per service is ideal.

---

## 4. Quick checklist

- [ ] JSON logs with request id.
- [ ] Generate or honor client request id; propagate downstream.
- [ ] RED metrics + dependency health.
- [ ] W3C trace context + OTel.
- [ ] Scrub secrets from telemetry.

See [reference.md](reference.md) and [examples.md](examples.md).

