1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-21 01:27:01 +02:00
dockerfiles/statsd
2023-04-07 18:01:59 +08:00
..
data
docker-compose.yml
Dockerfile update statsd 2023-04-07 18:01:59 +08:00
README.md

statsd

StatsD is a network daemon that runs on the Node.js platform and listens for statistics, like counters and timers, sent over UDP or TCP and sends aggregates to one or more pluggable backend services (e.g., Graphite).

docker-compose.yml

version: "3.8"

services:
  statsd:
    image: vimagick/statsd
    ports:
      - "8126:8126/tcp"
      - "8125:8125/udp"
    volumes:
      - ./data/config.js:/opt/statsd/config.js
    restart: unless-stopped

networks:
  default:
    external: true
    name: graphite_default

python client

$ pip install statsd
import statsd
c = statsd.StatsClient('localhost', 8125)
c.incr('foo')  # Increment the 'foo' counter.
c.timing('stats.timed', 320)  # Record a 320ms 'stats.timed'.