statsd 指标名称中的空格

Whitespace in statsd metric name

在将数据推送到 statsd 收集器时,我需要将空格作为指标名称的一部分传递。规范没有提及是否允许这样做,但是插入带有空格的值是行不通的。

ref locale:23.5|g

https://github.com/b/statsd_spec

是否有特殊字符转义等解决方法?

您要将 statsd 指标发送到哪里? Statsd 可能允许在指标名称中使用空格,但我相信 Graphite 不允许。

参见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.

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.

抱歉找不到权威来源。

我认为最好的办法是用“_”等其他字符替换指标中的空格。