'How to view the metrics ready to be sent off to Datadog
So I am new to metrics and micrometer. I am have followed this tutorial in which we set up some basics Meters like a counter and a Gauge and expose the metrics. I am able to see the metrics when I hit the endpoint /actuator/prometheus
. I can seem my custom meters there.
So now I am trying to expose the metrics to datadog. I have imported the following dependency:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-datadog</artifactId>
<version>1.8.5</version>
</dependency>
and also have this on my application.properties file:
management.endpoints.web.exposure.include=*
management.metrics.export.datadog.apiKey=123
I am aware i have not included any url to data or any of that sort but i was under the impression that i could simply see the metrics im collecting via the actuator endpoint by accessing something like /actuator/datadog
? Is my understanding correct? I essentially want to see the metrics im collecting before sending it out to datadog. Is this possible?
Solution 1:[1]
No, you can't see any metrics under /actuator/datadog
since the metrics are pushed rather than pulled.
The usual approach used in a Spring Boot application together with Datadog is to send data out from the app is over UDP and utilizing the StatsD protocol for the message structure. You can achieve this by adding micrometer-registry-statsd
to your dependency which will auto-configure the app.
Some config for Datadog:
management:
metrics:
export:
statsd:
enabled: true
flavor: datadog
defaults:
enabled: true
datadog:
api-key: 123456
How can you inspect the metrics before it is sent to datadog?
One way of doing this during development is to inspect the UDP messages, so basically spin up a UDP server on localhost
and port 8125
(these are the default values but can be overridden).
I was in the same situation some time ago and wrote my own UDP server, you can see it here https://github.com/hcgoranson/UDP-server
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hans-Christian |