A local implementation of the dogstatsd protocol from Datadog
Datadog is great for production application metric aggregation. This project was inspired by the need to inspect and debug metrics before sending them to datadog.
dogstatsd-local is a small program which understands the dogstatsd and statsd protocols. It listens on a local UDP server and writes metrics, events and service checks per the dogstatsd protocol to stdout in user configurable formats.
This can be helpful for debugging metrics themselves, and to prevent polluting datadog with noisy metrics from a development environment. dogstatsd-local can also be used to pipe metrics as json to other processes for further processing.
This is a go application with no external dependencies. Building should be as simple as running go build in the source directory.
Once compiled, the dogstatsd-local binary can be run directly:
$ ./dogstatsd-local -port=8126Coming soon
$ docker run -p 8125:8125/udp jonmorehouse/dogstatsd-localWhen writing a metric such as:
$ printf "namespace.metric:1|c|#test" | nc -cu localhost 8125Running dogstatsd-local with the -format raw flag will output the plain udp packet:
$ docker run -p 8125:8125/udp jonmorehouse/dogstatsd-local -format raw
2017/12/03 23:11:31 namespace.metric.name:1|c|@1.00|#tag1When writing a metric such as:
$ printf "namespace.metric:1|c|#test" | nc -cu localhost 8125Running dogstatsd-local with the -format human flag will output a human readable metric:
$ docker run -p 8125:8125/udp jonmorehouse/dogstatsd-local -format human
metric:counter|namespace.metric|1.00 test
When writing a metric such as:
$ printf "namespace.metric:1|c|#test|extra" | nc -cu localhost 8125Running dogstatsd-local with the -format json flag will output json:
$ docker run -p 8125:8125/udp jonmorehouse/dogstatsd-local -format json | jq .
{"namespace":"namespace","name":"metric","path":"namespace.metric","value":1,"extras":["extra"],"sample_rate":1,"tags":["test"]}dogstatsd-local can be piped to any process that understands json via stdin. For example, to pretty print JSON with jq:
$ docker run -p 8125:8125/udp jonmorehouse/dogstatsd-local -format json | jq .
{
"namespace": "namespace",
"name": "metric",
"path": "namespace.metric",
"value": 1,
"extras": [
"extra"
],
"sample_rate": 1,
"tags": [
"test"
]
}- support datadog service checks
- support datadog events
- support interval aggregation of percentiles