Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push metric name sanitization to backends #110

Closed
mheffner opened this issue Jun 26, 2012 · 3 comments
Closed

Push metric name sanitization to backends #110

mheffner opened this issue Jun 26, 2012 · 3 comments
Assignees

Comments

@mheffner
Copy link
Contributor

Opening this as a general RFC.

Currently the main StatsD daemon performs a set of regex replacements to sanitize metric names:

        var key = bits.shift()
                      .replace(/\s+/g, '_')
                      .replace(/\//g, '-')
                      .replace(/[^a-zA-Z_\-0-9\.]/g, '');

These regular expressions are largely based on the acceptable name formats that Graphite (being the only backend) was able to handle. Now that we have a pluggable backend system, I'm proposing that we make this task a function of each backend to handle as is appropriate for its acceptable metric name character set.

One advantage of pushing this down to the backend level would be that different backends could handle the special characters as optional control sequences. For example, in the case of the Librato backend we would like a way to specify a custom source parameter on a stat by stat basis. One thought would be to use a prefix character, like (/), to separate the source name from the metric name:

db1.acme.com/gorets:1c

The Librato backend would split the source out based on the (/) character, while backends like Graphite would simply turn that into a metric named "db1.acme.com.gorets", like it does today.

@mrtazz
Copy link
Member

mrtazz commented Jun 26, 2012

I think this is a good idea. I'd love to see more code pushed into the backends, where it makes sense.

@Dieterbe
Copy link
Contributor

what's the status of this? histogram support (#162) suffers from keys like 'bin_0.5' not being sanitized to 'bin_0_5' (or whatever)

@draco2003
Copy link
Contributor

Closing this, since we'll pull #155 after the config flag is added.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants