typescript.missing_correlation_id
Observability
Medium
Detects HTTP handlers without correlation ID propagation for distributed tracing.
Why It Matters
Section titled “Why It Matters”Missing correlation IDs:
- Break tracing — Can’t follow requests across services
- Hinder debugging — No way to correlate logs
- Increase MTTR — Slower incident resolution
Example
Section titled “Example”// ❌ Before (no correlation ID)app.get('/users/:id', async (req, res) => { const user = await userService.getUser(req.params.id); res.json(user);});// ✅ After (with correlation ID)import { v4 as uuid } from 'uuid';
app.use((req, res, next) => { req.correlationId = req.headers['x-correlation-id'] as string || uuid(); res.setHeader('x-correlation-id', req.correlationId); next();});
app.get('/users/:id', async (req, res) => { const user = await userService.getUser(req.params.id, { correlationId: req.correlationId, }); res.json(user);});What Unfault Detects
Section titled “What Unfault Detects”- Handlers without correlation ID extraction
- Missing correlation ID header forwarding
- Logs without correlation context