Repository navigation
[SVLS-8245] Give each Windows Azure Function its own named pipes - #43
Merged
Merged
Conversation
This was referenced Oct 15, 2026
With a pipe set, the binary listens on UDP only when DD_DOGSTATSD_PORT is set, so it doesn't take 8125 from a neighbor whose binary has no pipe. The .NET and Node layers point their in-process clients at the pipe, but a JVM can't change its own environment after it starts. A DogStatsD client that doesn't read dd.dogstatsd.pipe.name, or can't open the pipe, still sends to UDP 8125, so compat-java sets DD_DOGSTATSD_PORT=8125 for its binary. A port the customer already set wins.
On Windows Azure Functions, compat-java now always passes pipe names and DD_DOGSTATSD_PORT to the binary, as the .NET compatibility layer gives its binary pipes whether or not a tracer is present. Only dd-java-agent's system properties still depend on the version gate. With a pipe, a taken UDP 8125 or TCP 8126 makes the binary warn and keep running instead of panicking, so Java apps with an older or missing tracer stop crashing next to a neighbor that owns the port. Their tracer keeps TCP and UDP: dd-java-agent learns a pipe name only from its own configuration, never from the binary.
The JVM runs -javaagent premains in command-line order. A tracer listed first can read its settings before the compat layer sets the pipe system properties, and then keeps TCP and UDP. The gate now notes the order, and the compat layer logs a warning when the tracer would get pipes but comes first.
1.69.0 is the first dd-trace-java release with named pipe support (DataDog/dd-trace-java#12898). 1.68.2, released later from a patch branch, does not include it.
Lewis-E
force-pushed
the
lewis/SVLS-9467/java-pipe-names
branch
from
November 23, 2026 20:01
ef35d9c to
62ac771
Compare
Lewis-E
marked this pull request as ready for review
November 23, 2026 20:34
- Replace the stale placeholder comment on the minimum tracer version. - Store the minimum as numbers, removing the test-only overload and the invalid-minimum branch. - Add TracerVersionGate.failed so failure results don't carry the listed-first flag nobody reads. - Group each pipe's settings in a NamedPipe enum instead of passing four strings in a row. - Reword the configureNamedPipes Javadoc, the gate log lines, and the mismatch warning, which now says only that the binary uses the *_WINDOWS_PIPE_NAME value. - Fold the pipe setup in premain into one block. - Test that a passing gate sets both tracer system properties; merge a duplicate test and use literals for Premain-Class values.
Check the pipe name length in one place, and say whether dd-java-agent uses the binary's pipe name or keeps its own when the customer set two different names.
Drop the claim that dd-java-agent keeps its own settings, which is wrong when there is no tracer, and say the binary only tries the TCP and UDP ports.
duncanpharvey
approved these changes
Nov 24, 2026
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?
Give each function app its own trace and DogStatsD named pipes for Java-based Azure Functions.
passesdd.trace.pipe.nameanddd.dogstatsd.pipe.namesystem properties todd-java-agent`.DD_APM_WINDOWS_PIPE_NAMEandDD_DOGSTATSD_WINDOWS_PIPE_NAME, plusDD_DOGSTATSD_PORT=8125unless the customer already set a port.NamedPipeNamesfollows the .NETCompatibilityLayerorder for each pipe:DD_APM_WINDOWS_PIPE_NAME/DD_DOGSTATSD_WINDOWS_PIPE_NAME, used as written.-Ddd.trace.pipe.name/-Ddd.dogstatsd.pipe.name, elseDD_TRACE_PIPE_NAME/DD_DOGSTATSD_PIPE_NAME.dd_trace_<guid>/dd_dogstatsd_<guid>.It logs a warning when a customer-set name differs from the
*_WINDOWS_PIPE_NAMEvalue, and when a name is longer than 256 characters.Safety Gate
The binary always gets pipes;
dd-java-agentgets them only when it is new enough. If the tracer is older, missing, or unreadable, the agent logs why at INFO and sets no system properties, so the tracer keeps today's TCP 8126 and UDP 8125 behavior, or pipe settings a customer configured by hand.The gate exists because no released dd-trace-java can use a pipe. Releases that include DataDog/dd-trace-java#12898 can handle these properties without hanging or crashing.
TracerVersionGate.MINIMUM_TRACER_VERSIONis1.69.0, the first dd-trace-java release with those fixes (DataDog/dd-trace-java#12898). serverless-components#181 is also a requirement for this release. Without it, customerjava-dogstatsd-clientcode that sends tolocalhost:8125loses its metrics.Motivation
SVLS-9467 / SVLS-8245. Java function apps that share an Elastic Premium or Dedicated plan also share instances. Their binaries collide on one pipe name or port. Per-function pipes fixed this for .NET (datadog-serverless-compat-dotnet#20) and Node (datadog-serverless-compat-js#46). Java implements this functionality with system properties instead of environment variables because a JVM can't change its own environment after it starts, and dd-trace-java's
Configalready readsdd.*.pipe.nameproperties ahead of environment variables.Additional Notes
java-dogstatsd-clientdefaults ignoredd.dogstatsd.pipe.nameuntil DataDog/java-dogstatsd-client#344 (SVLS-8246) is in a client release.Describe how to test/QA your changes
mvn testpasses, including these new tests:NamedPipeNamesTestcovers the name order, JVM options beating environment variables, empty values, generated names, and both warnings.ServerlessCompatAgentTestchecks that the binary gets both pipe names andDD_DOGSTATSD_PORT=8125, that a port the customer set wins, that a passing gate sets both tracer system properties, and that a failed gate still gives the binary pipes but sets no tracer system properties.TracerVersionGateTestchecks that the minimum, later versions, and dev builds of the minimum (1.69.0-SNAPSHOT,1.69.0-105-gefa6bd64) pass. Older (including 1.68.2), missing, non-jar, unversioned, and unparseable tracers fail. One test renames the tracer jar to prove the gate matches onPremain-Class. The tests write real jars with manifests to a temp directory.I also ran the gate in a JVM started with this agent and a real
dd-java-agent-1.59.0.jaras-javaagentoptions. It skipped the compat jar, found the tracer, and reported 1.59.0 as older than 1.68.0, the minimum at the time. Thepremainwiring has no unit test. An end-to-end run in serverless-compat-self-monitoring covers it: on shared EP1 and B2 plans, with dev builds of the binary, this agent, and dd-trace-java, each Java app got its own pipes, and traces, tracer metrics, and custom metrics all arrived. That run predates theDD_DOGSTATSD_PORTchange, so I'll rerun it.