IT operations

Compare Logs, Metrics and Traces for a Slow Request

Investigate a slow request by connecting metrics, traces and logs while accounting for sampling, retries, asynchronous work and timing boundaries.

A slow request is an observation, not a diagnosis. It may spend time waiting for a database connection, calling another service, processing data or sitting behind other work. Logs, metrics and traces reveal different parts of that story. Using them together is more productive than expecting one dashboard to explain every delay.

OpenTelemetry’s documentation on signals distinguishes the forms of telemetry used to observe system behavior. This guide applies those distinctions to a practical investigation. It does not assume that installing an instrumentation library automatically produces complete or trustworthy evidence; the meaning and coverage of each signal still need review.

Define the slow operation precisely

Record the endpoint or customer action, the observed duration, the time range and the affected population. A slow search response and a slow file download may have different normal behavior. Avoid grouping every request under one average latency number.

For a fictional document-search service, distinguish time to receive the first response from time to render the complete result in the browser. The server may finish quickly while the client downloads large assets or performs expensive rendering. Decide which boundary the investigation is measuring.

Compare the symptom with the service’s intended behavior. A request can be slower than usual without violating its user expectation, or it can be consistently poor without a recent regression. Both deserve attention, but the evidence and prioritization may differ.

Use metrics to establish scope and timing

Metrics are useful for seeing patterns across many requests. Examine latency distributions, request counts and error rates for the affected operation. Break down the data by dimensions that are meaningful and available, such as region, application revision or request class.

Do not rely only on an average. A small group of very slow requests can matter to customers while the mean remains stable. Use the latency distribution supported by the monitoring system, and understand how its aggregation and windowing affect the view.

Check volume alongside latency. A percentile from a tiny number of requests can move sharply, while a large aggregate can hide a specific subgroup. Record the sample context so the team does not mistake a visualization artifact for a widespread regression.

Use traces to examine the request path

A distributed trace can show how a request passes through instrumented components and where spans account for time. Inspect representative slow requests and compare them with faster requests of the same kind. Look for differences in dependency calls, repeated operations and waiting periods.

Treat missing spans as missing evidence, not proof that no work occurred. Instrumentation may omit a library, background handoff or network stage. A large unexplained gap can be a clue that the observation boundary needs improvement rather than evidence of idle time.

Check whether the trace covers the complete user-visible operation. An asynchronous job may continue after the initial HTTP response. In that case, the request trace explains acceptance latency but not completion latency. Connect the relevant job evidence through supported context or identifiers without assuming every system preserves one continuous trace.

Use logs to understand specific decisions and failures

Logs can provide contextual events that metrics and spans do not capture: a cache miss reason, a selected processing path, a retry decision or an application error. Search within the relevant time range and correlate records using appropriate request or trace identifiers.

Avoid dumping entire payloads into logs to compensate for weak instrumentation. Sensitive data and excessive volume create their own risks and costs. Prefer structured fields that explain the decision being investigated, with access and retention appropriate to the information.

A log line saying that an operation began and another saying it ended can support a duration estimate, but verify that they refer to the same execution and clock context. Retries, parallel work and reused identifiers can make a simple text search misleading.

Correlate the signals through a shared timeline

Place the request symptom, metric change, trace evidence and relevant log events on one timeline. Include deployments, configuration changes and dependency incidents. Temporal association helps form a hypothesis, but it does not by itself establish cause.

For the search example, metrics might show that only one revision has higher latency. Traces could show additional calls to a metadata service. Logs might explain that a fallback path is being selected after a cache validation failure. Together these observations form a more specific hypothesis than any one signal alone.

Check clock synchronization and timestamp semantics where the ordering matters. Some systems record event time, others ingestion time, and buffered logs can arrive late. A timeline that ignores those differences may incorrectly suggest that an action happened before its trigger.

Distinguish waiting from active computation

A long span does not necessarily mean the application used CPU for its entire duration. It may include connection acquisition, network waiting, rate limiting or a queue. Seek instrumentation that separates these stages when the distinction affects the proposed fix.

Compare resource metrics with the trace evidence. High CPU during a compute-heavy span suggests a different investigation from low CPU while requests wait for a connection pool. Neither observation is conclusive alone, but each narrows the questions worth asking.

Do not increase resources automatically. If the delay comes from a serialized lock or a remote service, adding application instances may not help and can increase pressure on the bottleneck. Match the mitigation to the observed constraint.

Account for retries and fan-out

A request may call several dependencies concurrently or sequentially. Understand the execution structure before adding individual span durations. Concurrent work can overlap, so summing every duration may exceed the request’s elapsed time without indicating a telemetry error.

Retries can inflate latency even when the final request succeeds. Look for repeated calls, backoff intervals and the error that triggered them. A success-rate dashboard may conceal this degradation because customers eventually receive a valid response after an unacceptable wait.

Fan-out can also make tail behavior important. A request that waits for many subrequests may be delayed by the slowest one. Determine whether every result is required, whether timeouts are aligned and whether the application has an intentional partial-response strategy. These are design questions to evaluate after the evidence identifies the pattern.

Understand sampling and retention limits

Trace sampling means the available traces may not represent every request. Check the configured policy and whether slow or erroneous requests are captured differently. An absence of slow traces does not disprove a latency problem shown by other evidence.

Logs and metrics may have different retention periods and aggregation levels. If the incident is old, the detailed evidence may no longer exist. State that limitation rather than presenting a confident explanation based on incomplete historical data.

When increasing telemetry temporarily, bound the scope and duration. Consider data sensitivity, overhead and cost. Collect the evidence needed to test a hypothesis, then review whether the additional instrumentation should remain or be reduced.

Test one explanation at a time

Write a hypothesis that connects a cause to an observable effect. For example: a new fallback path adds a remote call for requests with a particular metadata state, increasing their latency. Identify what evidence would support or contradict that explanation.

Use a controlled reproduction or limited change where practical. Compare the same request class before and after the intervention while watching protective signals such as errors and resource pressure. Do not declare a fix from one faster request if workload conditions changed substantially.

Preserve the original measurements and record the test conditions. This allows another reviewer to assess whether the result generalizes. If the evidence contradicts the hypothesis, update it and choose the next question rather than collecting more screenshots of the same unexplained symptom.

Improve observability at the missing boundary

After the investigation, identify where the team lacked useful evidence. The right improvement may be a connection-wait metric, a span around a dependency call or a structured log explaining a fallback decision. Adding more telemetry everywhere is not automatically better.

Define the question each new signal should answer and who will use it. Review cardinality, sensitive fields and operational cost. A narrowly designed signal can provide more value than a large volume of unstructured events.

Close the investigation with a causal explanation only as strong as the evidence supports. Record the observed improvement and any remaining uncertainty. Metrics establish the shape of the problem, traces expose its path and logs explain specific events; their value comes from connecting those views to a testable account of what the service is doing.

Continue reading

Test a Recovery Plan Across More Than One Team

Define a Service Level Objective Around One Customer Journey