Skip to content

typescript.missing_tracing

Observability Medium

Detects functions lacking distributed tracing instrumentation.

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
// ❌ 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();
}
});
}
  • Public functions without spans
  • Missing span attributes
  • No error recording in spans