David
David

Reputation: 605

Spring micrometer actuator StatsD tags definition

I'm trying to configure spring actuator metrics along with micrometer to be sent to Datadog stastd agent.

Still, I'd like to get them all sent with a tag, so that I can filter in my Datadog dashboard just my service metrics, and not considering other services metrics.

I've added:

management:
  metrics:
    tags:
      application: my_app

to my service metrics configuration, but I can't see this tag value in Datadog dashboard. I'm not seeing anything weird in app logs nor actuator logfile neither.

I have nothing else regarding metrics in my service, as I don't want to implement custom metrics, just want to use the one provided by actuator.

This is how the whole metrics configuration looks like:

management:
  metrics:
    export:
      statsd:
        host: ${STATSD_AGENT_HOST}
        port: ${STATSD_AGENT_HOST_PORT}
        flavor: datadog
    tags:
      application: my_app
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

Versions:

micrometer version: 1.6.4

actuator version: 2.4.3

spring version: 2.3.8

Any clue about what I could be missing to get the tag reaching Datadog?

Thanks!

Upvotes: 0

Views: 2079

Answers (1)

Jonatan Ivanov
Jonatan Ivanov

Reputation: 6863

We figured this out in the comments, I'm posting an answer that summarizes it all up: it seems the root cause was using different versions of different spring-boot modules.

It is a good rule of thumb to not define the versions yourself but use BOMs and let them define the versions for you, e.g. see: spring-boot-dependencies. This way you will use the compatible (and tested) versions.

management.metrics.tags.your-tag is the way to add tags to all of your metrics. A good way to check this is looking at /actuator/metrics.

Upvotes: 2

Related Questions