skills/observability-apm-expert/SKILL.md
OpenTelemetry, distributed tracing, Grafana, and Datadog for full-stack observability. Activate on: observability, tracing, OpenTelemetry, Grafana, Datadog, metrics, logging, APM, SLO, alerting. NOT for: application error handling (use relevant language skill), security monitoring (use relevant security skill).
npx skillsauth add curiositech/windags-skills observability-apm-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implement comprehensive observability with distributed tracing, metrics, structured logging, and SLO-based alerting using OpenTelemetry and modern backends.
Error Rate Analysis:
├── Error rate < 0.1%
│ ├── Low cardinality service (< 10k spans/min) → 100% sampling
│ └── High cardinality service (> 10k spans/min) → Tail-based sampling
│ ├── Keep all error traces (100%)
│ ├── Keep slow traces > P95 latency (100%)
│ └── Sample successful traces (1-10%)
└── Error rate > 0.1%
├── Critical service → Keep all errors + 50% successful
└── Non-critical service → Keep all errors + 10% successful
If self-hosted tolerance = high AND cost sensitivity = high:
├── Use Grafana stack (Tempo + Mimir + Loki)
└── Export via OTLP to unified collector
If operational overhead tolerance = low OR compliance = strict:
├── Cloud vendors (Datadog, New Relic, Honeycomb)
└── Direct SDK exports + OTLP fallback
If hybrid requirements:
├── Critical services → SaaS backend
└── Development/staging → Self-hosted stack
For each SLO:
├── Define error budget (e.g., 99.9% = 43.2min downtime/month)
├── Calculate burn rates:
│ ├── Fast burn (14.4x) over 1h → Critical alert (2min delay)
│ ├── Medium burn (6x) over 6h → Warning alert (15min delay)
│ └── Slow burn (3x) over 24h → Info alert (1h delay)
└── Link each alert to specific runbook action
Symptom: Metrics cardinality > 10M series, query timeouts, high storage costs
Detection: prometheus_tsdb_head_cardinality growing exponentially
Fix: Add label cardinality limits, aggregate high-cardinality labels, use recording rules
Symptom: Spans appearing disconnected, missing parent-child relationships
Detection: Spans with same trace_id but no parent reference in service map
Fix: Verify context propagation headers (traceparent/tracestate), check async context handling
Symptom: > 10 alerts per incident, team ignoring notifications Detection: Alert:incident ratio > 5:1, MTTA (time to acknowledge) > 30min Fix: Implement alert dependencies, use SLO burn rate instead of threshold alerts
Symptom: Critical errors not captured in traces, debugging impossible Detection: Error logs present but corresponding traces missing Fix: Switch to tail-based sampling, increase error trace retention to 100%
Symptom: Traces terminate at service boundaries, no cross-service correlation
Detection: Spans from downstream services have different trace_id
Fix: Verify HTTP headers propagation, add OTel middleware to all services
Scenario: Customer reports 5-second checkout timeouts starting 2 hours ago
Step 1 - Triage with SLO dashboard:
P99 latency jumped from 200ms → 5000ms at 14:30 UTC
Error rate spiked from 0.1% → 2.3%
SLO burn rate: 46x (critical threshold)
Step 2 - Trace analysis:
-- Find slow traces in time window
{service_name="checkout-service"} |= "POST /checkout"
| json | duration > 2s | trace_id
Expert insight: Filter by duration first, then sample traces - don't analyze all traces
Step 3 - Root cause drill-down:
Selected trace_id: abc123
├── checkout-service: 50ms (normal)
├── payment-service: 4.8s (🚨 anomaly)
│ ├── validate_card: 45ms
│ ├── fraud_check: 12ms
│ └── database_query: 4.7s (🚨 root cause)
└── inventory-service: 100ms
Step 4 - Correlate with infrastructure:
Database span attributes show:
- db.statement: "SELECT * FROM transactions WHERE user_id = ?"
- db.connection.pool.idle: 0
- db.connection.pool.max: 10
Expert insight: Connection pool exhaustion - scale pool or optimize queries
Resolution: Increased connection pool from 10 → 50, added query timeout
Scenario: Add business metrics for order processing pipeline
// 1. Initialize custom meter
import { metrics } from '@opentelemetry/api';
const meter = metrics.getMeter('order-service', '1.0.0');
// 2. Define business metrics
const ordersTotal = meter.createCounter('orders_total', {
description: 'Total orders processed',
unit: '1'
});
const orderValue = meter.createHistogram('order_value_dollars', {
description: 'Order value distribution',
unit: 'USD'
});
// 3. Instrument business logic
async function processOrder(order: Order) {
const span = trace.getActiveSpan();
span?.setAttributes({
'order.id': order.id,
'order.user_id': order.userId,
'order.value': order.totalValue
});
try {
// Business logic here
await validateOrder(order);
await chargePayment(order);
// Record success metrics
ordersTotal.add(1, {
status: 'success',
payment_method: order.paymentMethod
});
orderValue.record(order.totalValue);
} catch (error) {
span?.recordException(error);
span?.setStatus({ code: SpanStatusCode.ERROR });
ordersTotal.add(1, { status: 'error' });
throw error;
}
}
traceparent header propagationtrace_id and span_id fieldsApplication Error Handling → Use relevant language skill (node-js-expert, python-expert, etc.) for try/catch, error boundaries, graceful degradation
Security Event Monitoring → Use security-expert skill for SIEM, threat detection, compliance logging
Log Storage Infrastructure → Use kubernetes-expert or cloud-expert for ELK stack deployment, log retention policies
Performance Testing → Use load-testing-expert for generating telemetry during performance validation
Cost Optimization → Use finops-expert for observability spend analysis and retention tuning
data-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.