Code QuizAdvanced

Emitting the Three Telemetry Pillars

Spot the bug in code that records a metric, a log, and a trace span for a request.

Codejavascript
// Three pillars: metrics, logs & traces
function handleRequest(req) {
  requestCounter.inc();              // metric
  logger.info('handling request', { path: req.path }); // log

  const span = tracer.startSpan('handleRequest'); // trace
  const result = doWork(req);
  logger.info('done', { path: req.path });

  return result;
}

What is the bug in this code?