micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.5k stars 994 forks source link

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 4 months ago

spachari-im commented 4 months ago

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.

To Reproduce How to reproduce the bug:

Expected behavior

Additional context

shakuzen commented 2 days ago

Thank you for the report, and sorry for the late triage on it.

  • Micrometer version [1.12.7]
  • Micrometer registry - StatsD [1.9.2]

You should use a single, consistent version of Micrometer. If you are using Spring Boot's dependency management, it should manage the version for you so you don't end up with two different versions like this. Using different versions has potential to cause issues.

I tried to reproduce the issue and I was not able to do so. I added the Dogstatsd client (StatsDClient) to a Spring Boot 3.4.0 app with Micrometer's statsd registry, and all metrics (from each client) were available in Datadog. Could you please try with the latest versions and ensure consistent versions are used to see if this is still an issue for you?

spachari-im commented 1 day ago

@shakuzen thanks for triaging this.

I did not override the micrometer version. I just specified it in the ticket. The only micrometer dependency in the propject's pom file is this:

<dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-statsd</artifactId>
    </dependency>

I tried this test after upgrading the Spring Boot version to 3.4.0. I get the same behavior - if a StatsD client is added for custom metrics, the custom metrics are reported but JVM metrics are not shown.

The JVM metrics are shown when the StatsD client is removed.

I think this is because of a setting enabled in the properties file or a dependency related to the Camel starter dependency - org.apache.camel.springboot.

Can you please post all the code you have used (properties enabled, bean declaration and pom dependency)?

shakuzen commented 1 day ago

Could you start with a minimal project and verify first whether you see the issue there, and then add things like the Camel starter to see if it affects things? The project I used is a bit complicated, but I expect it would work the same in a minimal project, so we need to figure out what in your project is causing the difference.