Prompt
How do I troubleshoot service dependencies from traces
Latest observation
To troubleshoot service dependencies from traces, use the trace data to reconstruct the request path, find where latency or failures start, and identify which downstream service is causing the issue.
1) Start with the slow or failed trace
Look for traces with:
- High total latency
- Errors or non-2xx responses
- Timeouts
- Retries or cascading failures
Open one representative trace and inspect the span tree.
2) Identify the critical path
The critical path is the longest chain of spans that determines overall request time.
Check:
- Which span starts first and ends last
- Where the largest time gaps are
- Which downstream calls block the parent request
If one child span consumes most of the trace duration, that dependency is likely the bottleneck.
3) Look for dependency patterns
Common signs of dependency problems:
- Many sibling spans to the same service → fan-out bottleneck
- Long downstream span with short parent work → dependency latency
- Repeated spans to the same endpoint → retries or inefficient loops
- Error in one child span followed by failures upstream → propagated dependency failure
- Timeout spans → service or network issue
4) Compare healthy vs unhealthy traces
Compare traces for:
- Total duration
- Span duration by service
- Error codes
- Retry counts
- Queue/wait time vs processing time
This helps distinguish:
- app code regression
- database slowness
- network latency
- overloaded downstream service
5) Check trace metadata and tags
Useful attributes include:
service.namespan.kindhttp.status_codedb.systempeer.servicenet.peer.nameerror=true- retry or timeout flags
These tell you exactly which dependency is involved.
6) Correlate with logs and metrics
Use trace IDs to jump to:
- logs for the failing span
- service metrics like CPU, memory, request rate, error rate, saturation
- dependency metrics like DB latency or queue depth
This confirms whether the trace shows an app issue or an external dependency issue.
7) Pay attention to async and messaging systems
For queues, Kafka, or async jobs:
- Trace parent/child boundaries may be broken or delayed
- Check producer span, queue wait time, consumer span
- Look for lag or redelivery patterns
The issue may be in the queue delay rather than service execution.
8) Common root causes you can infer from traces
- Slow DB query
- Downstream API timeout
- Thundering herd / retry storm
- Connection pool exhaustion
- Thread pool saturation
- DNS or network latency
- Cold starts or autoscaling delays
9) Practical workflow
- Filter traces by latency or errors
- Open a slow trace
- Find the longest span chain
- Identify the first failing or slow dependency
- Compare with normal traces
- Validate with metrics/logs
- Fix the dependency or add timeout/retry/backoff protection
10) What good traces should show
A healthy trace usually has:
- Clear parent/child structure
- Short, bounded downstream spans
- Minimal retries
- Low variance in dependency durations
- Errors isolated instead of cascading
If you want, I can also show:
- how to do this in OpenTelemetry
- how to analyze traces in Jaeger / Tempo / Datadog / Honeycomb
- a step-by-step example trace walkthrough