Distributed Tracing (Jaeger Example)
This tutorial walks through deploying a microservice architecture configured with Caddy Ingress domain jaeger.gbnt.local, generating synthetic OpenTelemetry traffic, and integrating with Gubernator's built-in Jaeger SRE Trace Collector.
π GuΓa Paso a Paso para Desarrolladores: Para aprender a configurar cualquier contenedor o aplicaciΓ³n propia (Python, Node.js, Go) para enviar trazas a Jaeger, lee la guΓa
how-use-jaeger.md.
π Overview & Architecture
When deploying microservice stacks, distributed tracing allows operators to follow a request as it travels through frontend gateways, backend APIs, and background processing workers.
Client / Browser βββΊ Caddy Ingress (jaeger.gbnt.local:80)
β
βΌ
jaeger-frontend (:8080)
β (creates parent span & OTLP trace)
βΌ
jaeger-api (:8085)
β (creates API child span & OTLP trace)
βΌ
jaeger-worker (:8086)
(creates worker child span & OTLP trace)
All microservices transmit OpenTelemetry trace spans directly to gbnt-monitor-jaeger over OTLP HTTP (:4318/v1/traces). Traces can be inspected inside the Gubernator Web UI under the Jaeger Traces tab or directly at http://localhost:16686.
π Tracing Scenarios
- Landing Page (
GET /): Standard web page visit emitting a 3-span cascade (jaeger-frontendβjaeger-apiβjaeger-worker). - E-Commerce Checkout (
GET /checkout): 4-span transaction (checkout-frontendβpayment-gatewayβinventory-serviceβnotification-worker). - User Authentication (
GET /auth/login): 3-span login flow (auth-frontendβidentity-providerβuser-db). - Catalog Search (
GET /search?q=query): 3-span search query with cache hit/miss semantics (search-frontendβredis-cacheβelasticsearch-cluster). - Simulated Error (
GET /error-demo): 3-span trace demonstrating error reporting, HTTP 500 status codes, and exception attributes.
π Deployment Steps
Deploy the stack via gbnt:
Verify service status:
π¦ Traffic Generation Tools (generate_traces.py & send_traces.sh)
Gubernator provides automated scripts to populate Jaeger with rich, multi-service OpenTelemetry traces:
1. Python Traffic Generator (generate_traces.py)
Sends customizable trace batches directly via OTLP (:4318) or HTTP requests (:8080):
# Send 20 traces cycling through all scenarios directly to Jaeger OTLP:
python3 examples/example-jaeger/generate_traces.py --count 20 --scenario all --target otlp
# Send 10 Checkout flow traces to a remote manager VM:
python3 examples/example-jaeger/generate_traces.py --count 10 --scenario checkout --endpoint http://192.168.252.18:4318/v1/traces
# Generate 15 HTTP requests against the frontend server:
python3 examples/example-jaeger/generate_traces.py --count 15 --scenario all --target http --endpoint http://localhost:8080/
CLI Parameters
| Flag | Description | Default |
|---|---|---|
--count N |
Number of trace batches to send | 10 |
--scenario |
Scenario preset (all, checkout, auth, search, error, landing) |
all |
--target |
Target protocol (otlp or http) |
otlp |
--endpoint URL |
Target endpoint URL | http://localhost:4318/v1/traces |
--delay SECONDS |
Inter-request delay in seconds | 0.2 |
2. POSIX Shell Generator (send_traces.sh)
Lightweight shell script powered by curl:
# Send 10 traces to local Jaeger OTLP:
./examples/example-jaeger/send_traces.sh 10
# Send 25 traces to remote manager node:
./examples/example-jaeger/send_traces.sh 25 http://192.168.252.18:4318/v1/traces
π Inspecting Traces in Jaeger UI
- Open Gubernator Web UI at
http://localhost:4001/and navigate to the Jaeger tab. - Select a service from the Service dropdown (e.g.,
checkout-frontend,auth-frontend, orjaeger-frontend). - Click Find Traces.
- Click on any trace to inspect:
- Total latency and span breakdown.
- Parent-child span hierarchy.
- Resource and span attributes (e.g.
db.system=postgresql,payment.provider=stripe,user.id=usr_4821). - Failed spans highlighted in red with error logs and stack traces.