Answer to the Core Questions
Does the Jaeger UDP sender perform automatic retries on transient send failures?
No. The UDP exporter in Jaeger’s Go client is fire‑and‑forget. It sends a single UDP packet to the agent and never waits for an acknowledgment. The only timeout you see is the client’s internal socket write deadline, which is why the log reports context deadline exceeded when the packet cannot be queued.
If retries are not performed, what configuration or pattern should be used to achieve reliable span export in tests?
Because UDP offers no delivery guarantees, the typical pattern for test environments is to replace the UDP exporter with a reliable transport:
- Use the
HTTP exporter (Thrift over HTTP) or the gRPC exporter. Both send spans in a request/response cycle and will surface transport errors.
- Run a local Jaeger agent or a mock collector that accepts HTTP/gRPC requests. The agent can be started with
jaeger‑agent --collector.host-port=localhost:14268 or a lightweight in‑process mock.
- If you must keep the UDP path (e.g., for integration with production code paths), add an explicit retry layer in your test harness: write a wrapper that attempts to send the span up to
N times with a back‑off delay, catching context deadline exceeded and other I/O errors.
- Alternatively, use the
noop tracer for unit tests that do not need real span data, and inject a mock collector only for integration tests that validate export logic.
Is enabling the HTTP sender with a NoopTracer or mock collector a safer approach for credential‑free test suites?
Yes. The HTTP exporter will surface transport failures immediately, and a mock collector can be spun up without any credentials. This eliminates the “silent drop” problem of UDP and gives deterministic visibility into span export during tests.
Practical Verification Steps
- Check the agent’s listening port:
netstat -anu | grep 6831
- Test UDP reachability from the test host:
nc -u -zv 6831
- If using Docker, ensure the container can reach the host’s UDP port (e.g.,
--network host or port mapping).
- Confirm the client configuration points to the correct host/port. In Go, this is typically set via
jaegerconfig.WithAgentEndpoint(jaegerconfig.WithAgentHost("localhost"), jaegerconfig.WithAgentPort("6831")).
- For HTTP/gRPC, start a local collector:
jaeger‑collector --log-level=debug --port=14268
- Run the test and watch the logs for any
error entries from the exporter. A missing error indicates the span reached the collector.
Missing Diagnostic Detail
To give the most precise recommendation, could you confirm the IP address and port that the Jaeger agent is configured to listen on in your test environment? This determines whether the client should target localhost or a remote host.