# Distributed Tracing

 

Implement distributed tracing with Jaeger and Tempo to track requests across microservices and identify performance bottlenecks. Use when debugging microservices, analyzing request flows, or implementing observability for distributed systems.

 

**Licence** MIT

 

**Source** wshobson/agents

 [Download zip](<https://delaparra-services.nl/skills/distributed-tracing/download>)   

# Distributed Tracing

 

Implement distributed tracing with Jaeger and Tempo for request flow visibility across microservices.

 

## Purpose

 

Track requests across distributed systems to understand latency, dependencies, and failure points.

 

## When to Use

 

- Debug latency issues 
- Understand service dependencies 
- Identify bottlenecks 
- Trace error propagation 
- Analyze request paths

 

## Detailed patterns and worked examples

 

Detailed pattern documentation lives in ` references/details.md `. Read that file when the navigation tier above is insufficient.

 

## Best Practices

 

1. **Sample appropriately** (1-10% in production) 
1. **Add meaningful tags** (user\_id, request\_id) 
1. **Propagate context** across all service boundaries 
1. **Log exceptions** in spans 
1. **Use consistent naming** for operations 
1. **Monitor tracing overhead** (\<1% CPU impact) 
1. **Set up alerts** for trace errors 
1. **Implement distributed context** (baggage) 
1. **Use span events** for important milestones 
1. **Document instrumentation** standards

 

## Integration with Logging

 

### Correlated Logs

 

```
import logging
from opentelemetry import trace

logger = logging.getLogger(__name__)

def process_request():
    span = trace.get_current_span()
    trace_id = span.get_span_context().trace_id

    logger.info(
        "Processing request",
        extra={"trace_id": format(trace_id, '032x')}
    )
```

 

## Troubleshooting

 

**No traces appearing:**

 

- Check collector endpoint 
- Verify network connectivity 
- Check sampling configuration 
- Review application logs

 

**High latency overhead:**

 

- Reduce sampling rate 
- Use batch span processor 
- Check exporter configuration

 

## Related Skills

 

- ` prometheus-configuration ` - For metrics 
- ` grafana-dashboards ` - For visualization 
- ` slo-implementation ` - For latency SLOs

 

## Files

 

- ` LICENSE ` 
- ` SKILL.md ` 
- ` SOURCE.md ` 
- ` references/details.md `

 

## Related terms

 

- [context propagation](<https://delaparra-services.nl/knowledge-hub/context-propagation>) 
- [instrumentation](<https://delaparra-services.nl/knowledge-hub/instrumentation>) 
- [Jaeger](<https://delaparra-services.nl/knowledge-hub/jaeger>) 
- [OpenTelemetry (OTEL)](<https://delaparra-services.nl/knowledge-hub/opentelemetry-otel>) 
- [sampling](<https://delaparra-services.nl/knowledge-hub/sampling>) 
- [span](<https://delaparra-services.nl/knowledge-hub/span>) 
- [trace](<https://delaparra-services.nl/knowledge-hub/trace>)

 

[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)

[HTML version](https://delaparra-services.nl/skills/distributed-tracing)
