I am trying to send customer metric from local using docker. I am running two containers:
datadog agent: exposing on 8126/tcp
datadog statsD agent: exposing on 8125/udp
This is my docker-compose file:
agent:
image: "datadog/agent:latest"
environment:
- DD_API_KEY=<key>
- DD_APM_ENABLED=true
- DD_LOGS_ENABLED=true
- DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true
- DD_PROCESS_AGENT_ENABLED=true
- DD_TAGS='ohm:local'
ports:
- "8126:8126/tcp"
networks:
- imploy_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
StatsD:
image: "datadog/dogstatsd:latest"
environment:
- DD_API_KEY=<key>
- DD_APM_ENABLED=true
- DD_LOGS_ENABLED=true
- DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true
- DD_PROCESS_AGENT_ENABLED=true
- DD_TAGS='ohm:local'
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
- DD_ENABLE_METADATA_COLLECTION=true
- DD_SEND_HOST_METADATA=true
- DD_DOGSTATSD_DISABLE=false
- DD_AGENT_HOST=agent
ports:
- "8125:8125/udp"
networks:
- imploy_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro```
I am connecting to `localhost:8125` in code and trying to send some `Incr` and `Gauge` metric. but i could not able to see it in my datadog metric explorer. Just FYI, all the logs in the application is being appeared normally on datadog but its just the metrics which I am not able to see.
can some please help me out with this.
I fixed it. in case if someone faces the same issue, while connecting from code, you need to specify the container name, instead of localhost:8125 you need to specify StatsD:8125
Curious why you’re running the agent AND the statsd image. If I’m not mistaken the dogstatsd standalone image is meant for setups where you don’t need the full agent.
> This package is used in containerized environments where DogStatsD runs as a sidecar or environments running a DogStatsD server without full Agent functionality.
Ohh yes, Thanks a lot, it was really helpful . I will try to first expose 8125 on same container, lets see if it works, if it does not, will reach out to dd