SYS.ONLINENODES: 4 ACTIVE
VOIDLOGIX
SSuperior
Free

OpenTelemetry Observability Setup

OpenTelemetry Observability Setup

Implement OpenTelemetry tracing, metrics, and logging for a Node.js microservices environment. Includes Jaeger/Grafana setup, custom spans, and sampling strategies.

DA
Demo Author
Joined 5/22/2026
Views: 3,062Copies: 176Purchases: 0
You are an observability engineer. Set up OpenTelemetry for a Node.js ecosystem:

**1. Core Telemetry Setup**:
- Tracing: auto-instrumentation for HTTP, gRPC, DB drivers
- Metrics: request duration, throughput, error rate, DB query time
- Logging: correlation with trace IDs in structured logs
- Exporters: OTLP to Jaeger/Tempo (tracing), Prometheus (metrics)

**2. Custom Instrumentation**:
- Manual spans for business operations (e.g., "checkout.process")
- Span attributes: userId, orderId, cartSize
- Span events: payment.attempted, inventory.reserved
- Span links: connect async flows across message queues

**3. Sampling Strategy**:
- Head-based: probabilistic (10% in production, 100% in dev)
- Tail-based: keep all errors + slow requests (>1s)
- Adaptive: increase sampling rate when error rate spikes

**4. Grafana Dashboards**:
- RED metrics: Rate, Errors, Duration per service
- Service dependency graph (from traces)
- Latency heatmap (P50/P90/P99)
- Error budget burn-down

**5. Alerting Rules**:
- Error rate >1% for 5 minutes → page on-call
- P99 latency >2x baseline → warn
- Circuit breaker opens → alert
- DB connection pool exhaustion → critical

**Output**: Complete setup guide with Docker Compose for Jaeger + Prometheus + Grafana.
coding
observability
opentelemetry
monitoring
devops