tim-group / java-statsd-client

a java statsd client library
Other
275 stars 139 forks source link

Delete ":" from metric names to allow statsd server insert them #46

Open odin-delrio opened 7 years ago

odin-delrio commented 7 years ago

Copy of https://github.com/DataDog/java-dogstatsd-client/issues/27

I don't know if this repository is accepting issues/PRs, but just in case...

--

Hi all!

I'm currently using statsd to automatically record all the metrics provided by some spring boot application. In my case, spring is creating some metrics with ":" in the name (for some hystrix with feign stats), and these ones are skipped by the statsd server (https://github.com/etsy/statsd).

That implementation allow to insert multiple metric types to the same metric:

$ echo "xxx:1|c:3|g" | nc -u -w0 127.0.0.1 8125 && echo "counters" | nc localhost 8126 && echo "gauges" | nc localhost 8126

Produces this output:

{ 'statsd.bad_lines_seen': 0,
  'statsd.packets_received': 1,
  'statsd.metrics_received': 1,
  xxx: 1 }
END

{ xxx: 3 }
END

This (undocumented) statsd feature does not allow me to make a PR to statsd repository... So, That's why I'm here, would be acceptable to make you a PR (or request for the change) to simply delete the ":" in the metric names?

The statsd server is already deleting some characters from metric name: https://github.com/etsy/statsd/blob/master/stats.js#L170