Search code examples
statsd

Whitespace in statsd metric name


I need to pass whitespace as part of metric name when pushing data into a statsd collector. The specification doesn't mention if this is allowed, but inserting values with whitespace isn't working.

ref locale:23.5|g

https://github.com/b/statsd_spec

Is there a workaround such as special character escaping?


Solution

  • Where are you sending your statsd metrics to? Statsd might allow spaces in metric names, but I believe Graphite doesn't.

    See https://answers.launchpad.net/graphite/+question/171766:

    These metrics are stored on disk as the name provided. It's a core part of the current Whisper storage system.

    And http://mingbowan.blogspot.com.es/2012/08/enable-special-character-support-in.html:

    Graphite doesn’t support special characters like “ “ (empty space), “/” slash etc. Because it expect everything to be just ASCII to split/processing them, and then make directories based on metric name.

    I'm sorry I couldn't find an authoritative source.

    I think your best bet would be to replace spaces in your metrics by some other character like "_".