3

I have Spring Boot 2.5.2 and I am trying to send StatsD metrics to Datadog. However, that didn't work for me. So I wrote a single python script to check if my application is sending any data or not.

application.properties

management.metrics.export.statsd.enabled=true
management.metrics.export.statsd.host=localhost
management.metrics.export.statsd.port=8125

Python script

from socket import *
serverName = 'localhost'
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind((serverName, serverPort))
print("Server is ready.")


while True:
    msg, clientAddr = serverSocket.recvfrom(2048)
    word = msg.decode()
    print(word)
    msg = ''
    serverSocket.sendto(msg.encode(), clientAddr)

I tested this script with the following command:

$ echo "foo:1|c" | nc -u -w0 127.0.0.1 12000

and it was logged by the script.

I changed management.metrics.export.statsd.port to 12000, but nothing was being sent. Is there a way to diagnose this?

Saif
  • 2,530
  • 3
  • 27
  • 45

0 Answers0