Skip to content
Latchkey

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.

text
ERROR jaeger could not upload jaeger batch:
Post "http://localhost:14268/api/traces": dial tcp 127.0.0.1:14268:
connect: connection refused

Common 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

  1. Turn tracing off in test env so the HTTP sender is not created.
  2. If a test needs the collector, run jaeger all-in-one and expose 14268.
  3. Point JAEGER_ENDPOINT at the service, not a staging host.
.github/workflows/ci.yml
services:
  jaeger:
    image: jaegertracing/all-in-one:latest
    ports: ['14268:14268', '16686:16686']
env:
  JAEGER_ENDPOINT: http://jaeger:14268/api/traces

Use 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.

Frequently asked questions

What causes ""connection refused" on 14268"?
The HTTP sender targets the collectors /api/traces` endpoint on port 14268. Without a collector service, the POST is refused.
How do I fix "connection refused" on 14268?
Disable reporting or run a collector service

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card