librato/statsd-librato-backend — pull request #44 by tomazk (2014-09-24 13:55:54+00:00)
Title: extract metric source and name from raw statsd metric name with functions in config

**motivation**

* say we have a metric `project_name.source.metric_name`
* `sourceRegex` assumes that we want to omit `project_name` from metric name when pushed to librato
* this is bad since librato has a single global namespace for all metrics

**solution**

introduce `measureName` and `measureSource` function that can be put in config

usage:
```
librato: {
email: "me@example.com",
token: "bla bla",
measureName: function (name) {
return name.replace(/^([^\.]+)\.([^\.]+)\./, '$1.');
},
measureSource: function (name) {
return name.match(/^[^\.]+\.([^\.]+)\./)[1];
}
}

```