When should you use metrics, logs or traces to investigate production behaviour?
Answer
Use metrics for aggregated rates, distributions and trends; logs for discrete events with detailed context; and traces for the path and timing of one request across components. Start from the decision or failure mode rather than collecting every possible field. Correlate the signals with consistent service, environment, version and request context so a tester can move from an abnormal metric to a representative trace and then to the relevant events.
Strong answer includes
- selects each signal for a distinct question
- correlates signals with shared context
- avoids indiscriminate telemetry collection
Practical example
A user reports that checkout is slow. The engineer first checks the p95 latency metric for the checkout service to confirm the trend, then pulls a representative slow trace to see which downstream span (the inventory service call) dominates the duration, and finally reads the structured logs for that request ID to see the exact retry and error details. Metrics located the problem, the trace pinpointed the component, and logs explained the cause.