Repository navigation
Conversation
When DD_DOGSTATSD_WINDOWS_PIPE_NAME is set, dogstatsd now keeps its UDP listener alongside the pipe, as #94 did for the trace agent. Clients that can't use a pipe, such as older java-dogstatsd-client versions, still reach the binary over 8125. With a pipe set, the UDP bind is best-effort, as #129 did for TCP 8126. Several function apps share one VM on Elastic Premium and Dedicated plans, so a second app's binary finds 8125 taken and must keep running on its pipe. Without a pipe, a failed bind still panics. datadog-serverless-compat no longer forces the dogstatsd port to 0 when a pipe is set, and logs both listeners. SVLS-9467
With a pipe set, main.rs logged "starting to listen on port 8125" even when the best-effort UDP bind had failed. The dogstatsd crate now logs the UDP listener at info when it binds, next to its existing warning when it doesn't, and main.rs logs only the pipe in that case. SVLS-9467
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When
DD_DOGSTATSD_WINDOWS_PIPE_NAMEis set, dogstatsd now listens on UDP 8125 and the named pipe together, as #94 did for the trace agent. With a pipe set, the UDP bind is best-effort, as #129 did for TCP 8126. A failed bind logs a warning and dogstatsd keeps running on its pipe. Without a pipe, a failed bind still panics, so Linux, Lambda and Windows without a pipe behave as before.datadog-serverless-compatno longer forces the dogstatsd port to 0 when a pipe is set. It logs the pipe listener, and the dogstatsd crate logs whether the UDP bind succeeded.Motivation
SVLS-9467: Java multi-function named pipes on Azure Functions. serverless-compat-java will give each function its own dogstatsd pipe. Customer code on a
java-dogstatsd-clientwithout pipe support, or set tolocalhost:8125, would lose custom metrics without any error if the binary stopped listening on UDP. On Elastic Premium and Dedicated plans several function apps share one VM, so only the first binary gets 8125, and the others must not crash.Additional Notes
tokio::select!. When the UDP bind failed, the UDP arm never completes, the sameOptionpattern as Make TCP port-8126 bind best-effort when named pipe is active #129.recv_fromerror such asConnectionResetends the shared read loop, which would also stop pipe reads. UDP-only mode already ends on that error, and the server never sends on the socket, so I expect it to be rare.Describe how to test/QA your changes
test_named_pipe_and_udp_dual_listensends one metric over UDP and one over the pipe to one server, then checks that the flush contains both and that cancellation stops it. It follows Listen on both TCP and named pipes when a pipe name is configured #94's dual-transport test.cargo clippypasses forx86_64-pc-windows-gnuwithwindows-pipes,windows-enhanced-metricsand on macOS. The Windows tests only run in Windows CI.