Zipkin reporter "failed to report spans" on port 9411 in CI
A Zipkin reporter posts encoded spans to http://localhost:9411/api/v2/spans. When no Zipkin server runs in CI, the connection is refused; depending on the client, spans are dropped or the reporter logs an error each flush.
What this error means
Logs show "Dropped ... spans" or "failed to report" / "connection refused" against :9411/api/v2/spans while the test suite runs.
Reporting spans to Zipkin failed:
POST http://localhost:9411/api/v2/spans failed:
connect ECONNREFUSED 127.0.0.1:9411Common causes
No Zipkin server on 9411 in CI
The reporter targets the default Zipkin collector endpoint on port 9411. Without a Zipkin service, POSTs are refused and spans are dropped.
Reporter created unconditionally in tests
The tracer initializes a Zipkin HTTP reporter regardless of environment, so importing the app under test starts trying to report.
How to fix it
Skip the Zipkin reporter in tests
- Use a no-op / in-memory reporter when running tests.
- If reporting must be exercised, run the Zipkin server as a service.
- Point the reporter endpoint at that service, not a remote host.
services:
zipkin:
image: openzipkin/zipkin:latest
ports: ['9411:9411']Assert on spans in memory
Collect spans with an in-memory handler and assert on them rather than posting to a live server.
How to prevent it
- Disable the Zipkin reporter for unit tests.
- Run openzipkin/zipkin as a service only when export is under test.
- Do not point CI reporters at remote Zipkin hosts.