Software Engineer Interview Question

What is the difference between logs, metrics and traces, and when do you reach for each?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Metrics are aggregated numbers over time, cheap to store, and what you alert on. Logs are discrete events with detail, what you read once you know roughly where to look. Traces follow one request across services and show where the time went. In an incident you typically go metrics to notice, traces to localize, logs to understand, so a system missing any one of the three makes debugging slower than it needs to be.

Why interviewers ask this

Interviewers ask this to see whether you have operated what you built. They want the alert on metrics, debug with logs and traces distinction, an appreciation of the cost difference since logs get expensive at volume, and ideally the point that structured logs carrying a correlation id are what make all three usable together. Vague answers suggest somebody who has never been paged.

How to structure your answer

  • Define each in one line by shape and cost.
  • Map them onto the incident workflow.
  • Stress the correlation id that ties them together.
  • Mention cardinality and cost limits.

Example answer

Spoken example, first person

Metrics are counters and histograms rolled up over time. They are cheap, they are what I put alerts on, and they tell me something is wrong but never why. Logs are individual events with context, expensive at volume, and what I read once I know where to look. Traces stitch one request across every service it touched and show the time in each span, which is the fastest way to answer whether the problem is us or a dependency. In an incident the workflow is basically metrics to notice, traces to localize, logs to understand. The thing that makes them work together is a correlation id propagated through every call and included in every structured log line, so from a slow trace I can jump straight to the exact log entries. The mistake I have made is cardinality: I once added user id as a metric label and the time series count exploded, which got expensive fast. High cardinality belongs in traces and logs, not in metric labels.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What would you alert on for a typical API service?
  • How do you keep logging costs under control at high volume?
  • How does sampling affect what you can learn from traces?

Related software engineer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot