typescript.missing_tracing
Observability
Medium
Detects functions lacking distributed tracing instrumentation.
Why It Matters
Section titled “Why It Matters”Missing tracing:
- Blind spots — Can’t see request flow
- No latency breakdown — Don’t know what’s slow
- Hard debugging — Can’t trace failures across services
Example
Section titled “Example”// ❌ Before (no tracing)async function processOrder(order: Order): Promise<void> { await validateOrder(order); await chargePayment(order); await sendConfirmation(order);}// ✅ After (with OpenTelemetry tracing)import { trace } from '@opentelemetry/api';
const tracer = trace.getTracer('order-service');
async function processOrder(order: Order): Promise<void> { return tracer.startActiveSpan('processOrder', async (span) => { try { span.setAttribute('order.id', order.id);
await tracer.startActiveSpan('validateOrder', async (s) => { await validateOrder(order); s.end(); });
await chargePayment(order); await sendConfirmation(order); } finally { span.end(); } });}What Unfault Detects
Section titled “What Unfault Detects”- Public functions without spans
- Missing span attributes
- No error recording in spans