Skip to content
advanced2 min readFree guide

Observability: choose logs, metrics and traces for the question

InterviewSolutionHub learning library · Updated

On this page

Operational evidence is easier to use when each signal answers a clear question. Logs record events, metrics summarise measurements and traces help follow work across a request or workflow.

Use logs for meaningful events

A useful log explains an event with context such as a request identifier, operation and outcome. Avoid recording every detail indiscriminately. Secrets and personal data can leak through exception payloads or copied request bodies. Choose safe fields and a retention policy appropriate to the application.

Use metrics to see patterns over time

Metrics can describe rates, counts, latency distributions and resource use. Define the unit and denominator clearly. An average can hide a slow tail, and a raw error count can be misleading when traffic changes. Keep label values controlled so a metric does not grow into an unmanageable series for every arbitrary user input.

A trace can relate spans across services or stages of one operation. Context propagation helps connect the pieces, but missing instrumentation or sampling means a trace is not automatically a complete record of every event. Combine signals to investigate a question rather than treating any one dashboard as the whole truth.

Worked example

A fictional CV analysis is slow. A metric shows the latency trend, a trace identifies a long external-provider call and a safe log records its timeout outcome using a request ID. None of the signals needs to contain the user’s actual CV text to explain that failure.

Check your understanding

Try each question before opening its explanation. These are free practice prompts; they do not use game chances.

Are logs and metrics interchangeable?

No. Logs describe individual events, while metrics summarise measurements over time. They can support the same investigation from different perspectives.

Why can an average latency hide a problem?

A small group of very slow requests can be obscured by many fast requests. Inspect an appropriate distribution or percentile along with the volume and context.

What would you record for a timed-out private document analysis?

Record a safe operation identifier, timing and error category. Avoid logging the document text, credentials or other sensitive payloads when they are not necessary to diagnose the failure.

Sources and further reading

These original examples explain foundational concepts. Use the official references for complete, current details and version-specific behaviour.

About this guide: AI-assisted educational content with original examples and linked primary references. Found an issue? Tell us what to improve.

Keep exploring Developer tools

All subtopics →