Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 3.x Micrometer StatsD registry does not send metrics to UDP port when another StatsD client is active on the same port #5313

Open
spachari-im opened this issue Jul 24, 2024 · 0 comments

Comments

@spachari-im
Copy link

spachari-im commented Jul 24, 2024

Describe the bug
In Spring Boot 3.x, Micrometer's inbuilt StatsD agent does not report JMX metrics when another StatsDClient is created to send custom metrics to the same host & port.

Environment
Spring Boot 3.2.7, Spring Camel version 4.5.0 application.

  • Micrometer version [1.12.7]
  • Micrometer registry - StatsD [1.9.2]
  • OS: MacOS
  • Java version: 17

To Reproduce
How to reproduce the bug:

  • Declare a StatsDClient bean to send custom metrics to Datadog
StatsDClient statsDClient = new NonBlockingStatsDClientBuilder()
                    .prefix(PREFIX)
                    .hostname(localhost)
                    .port(8125)
                    .build(); 
  • Add mcrometer-registry-statsd to project (in pom.xml).
  • Enable micrometer statsd metrics.
management.statsd.metrics.export.enabled=true
management.statsd.metrics.export.flavor=datadog
management.statsd.metrics.export.protocol=udp
management.statsd.metrics.export.host=localhost
management.statsd.metrics.export.port=8125
management.statsd.metrics.export.polling-frequency=10s
management.statsd.metrics.export.publish-unchanged-meters=true

Note: the Micrometer StatsD client and the custom StatsDClient both send metrics to the same host and port

  • The application does not report the implicit JVM metrics sent by Micrometer to the StatsD Agent to port 8125 (netcat -ulp 8125).
  • Only the custom metrics sent by the Datadog StatsD client is being reported to port 8125.
  • When the Datadog StatsD client is removed, the JVM metrics are successfully reported to port 8125.

Expected behavior

  • On port 8125 (netcat -ulp 8125) both the custom metrics sent through Datadog StatsD client and the internal JVM metrics sent by Micormeter should be visible.
  • Micrometer should report some warning in logs if metrics cannot be sent to the UDP port, instead of ignoring the metric.

Additional context

  • This configuration runs successfully on Spring Boot 2.x and Micrometer 1.9.2.
  • When the Datadog StatsD client is removed, the JVM metrics are successfully reported to port 8125.
  • It appears that the Micrometer StatsD agent does not work if there is another StatsD client sending to the same port (I am not sure of this)
  • There are no warnings in the logs to give an idea of why this happens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant