Correlate traces and logs to investigate latency in Coralogix
Identify a slow operation with p95, then inspect a trace and its related logs without confusing correlation with causation.
What you will create
Identify a slow operation from its spans, then inspect logs for a specific trace in Coralogix. A percentile describes a distribution of durations; logs provide context. Neither alone proves the cause of latency.
Before you start
Use traces and logs already available in a workspace you are authorized to read. Choose a specific service and period. Check account limits. This procedure requires no new instrumentation, field-mapping change or sensitive-data export.
Step-by-step
- Define comparable scope. Set service, environment and time before interpreting figures. Mixing development with production or unrelated operations can mislead comparisons.
- Calculate p95. In DataPrime, start with spans and group durations by operation. The percentile function takes a value between 0 and 1 and returns an estimate, not an exact measurement of every request.
- Return to individual spans. Once an operation is identified, find its slow spans within the same period. An aggregate row does not identify one trace; do not arbitrarily attach an identifier to it.
- Inspect related data. In Explore spans, open the span or trace, then Related data and Logs when available. Use trace correlation and check the selected log datasets. Do not change Setup Correlations just to eliminate an empty result.
- Check the identifier. Compare trace identifiers and event context. Field names can vary with instrumentation. An assumed field name is not evidence of a match.
- Form a limited hypothesis. Record events before and during the slowdown, then seek evidence that supports or contradicts your explanation. Compare a normal trace of the same operation when possible.
Example to adapt
This query uses documented syntax to calculate p95 by operation name; adapt scope and verify fields in your environment:
source spans
| groupby $l.operationName aggregate percentile(0.95, $m.duration) as p95_latencyFictional analysis: a slow trace contains a retry message, but a normal trace does too. You cannot conclude that every retry causes the slowdown. Compare their number, timing and the durations of the operations involved.
P95 is neither the average nor the error percentage. Check duration units before comparing the result with a threshold displayed in milliseconds.
Check your result
- Comparisons use the same service and operation, with an explicit time period.
- The inspected trace comes from individual spans, not an identifier invented after aggregation.
- Related logs carry the correct identifier and coherent context.
- Your conclusion separates observation, hypothesis and missing evidence.
Common problems
No associated logs: check time, dataset selection, identifiers and context propagation; an empty result does not establish that nothing happened. Unexpected p95: check units, sample volume and mixed operations. Duplicates: several logs can belong to one trace; do not count each row as an incident. Uncertain cause: keep the hypothesis open rather than blaming the first error message.
Next steps
See the Coralogix overview and keep each investigation's scope in your notes. No account, query, instrumentation or correlation configuration was used or modified for this guide.


