Jaeger client "connection refused" on collector port 14268 in CI
When configured to skip the agent, a Jaeger client posts spans directly to the collector HTTP endpoint http://localhost:14268/api/traces. In CI no collector listens there, so each report fails with connection refused.
What this error means
Test logs show a Jaeger reporter error posting to :14268/api/traces with "connection refused", and spans are dropped or the reporter queue fills.
ERROR jaeger could not upload jaeger batch:
Post "http://localhost:14268/api/traces": dial tcp 127.0.0.1:14268:
connect: connection refusedCommon causes
No Jaeger collector on 14268 in CI
The HTTP sender targets the collectors /api/traces` endpoint on port 14268. Without a collector service, the POST is refused.
Collector endpoint configured for a non-CI host
The endpoint points at a host that only exists in staging/prod, unreachable from the runner.
How to fix it
Disable reporting or run a collector service
- Turn tracing off in test env so the HTTP sender is not created.
- If a test needs the collector, run jaeger all-in-one and expose 14268.
- Point
JAEGER_ENDPOINTat the service, not a staging host.
services:
jaeger:
image: jaegertracing/all-in-one:latest
ports: ['14268:14268', '16686:16686']
env:
JAEGER_ENDPOINT: http://jaeger:14268/api/tracesUse an in-memory exporter for assertions
Assert on captured spans in memory instead of posting to a live collector.
How to prevent it
- Do not point CI at a staging/prod collector host.
- Run jaeger all-in-one only when collector reporting is under test.
- Disable tracing for unit tests that do not assert on export.