无法查看 statsd 发送的数据狗指标

Not able to see metrics on datadog sent by statsd

我正在尝试集成 statsd+datadog。

问题

我终于能够通过显式打开我的 docker 容器的 udp 端口​​来解决问题,即 -

-p 8125:8125/udp

具有必要环境变量和正确端口绑定的完整 docker 运行 命令将是

docker run --name dd-agent -e DD_API_KEY=<the-api-key> -e DD_SITE="datadoghq.com" -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC="true" -p 8125:8125/udp gcr.io/datadoghq/agent:7

为了将来参考,这里是来自控制台的官方文档:

If you plan on sending custom metrics via dogstatsd

By default dogstatsd will only listening to localhost, you need to add -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true option to the container's parameters to listen to dogstatsd packets from other containers (required to send custom metrics). Then bind the container's statsd port to the hosts's IP by adding the -p 8125:8125/udp option to the container's parameters. Then, configure your client library to send UDP packets to the hosts's IP.

参考:https://app.datadoghq.com/account/settings#agent/docker