-
Notifications
You must be signed in to change notification settings - Fork 13
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
add capability to also remove prefixes #7
base: master
Are you sure you want to change the base?
Conversation
@tiadobatima thanks! Can you describe the use case ? Seems like a pretty edge case. |
Not sure if it's that much of an edge case: when metrics come from jmxtrans or any software that doesn't allow us to configure the prefix prior to sending to statsd, the metric will endup in datadog as:
Where server.hostname1, and server.hostname2 are the prefix added by jmxtrans depending on the host the metric is coming from, and my.metric is the actual metric. And unless things changed, datadog doesn't allows us to aggregate different metric names as Graphite does. So, we have to send the metric as my.metric and tag it with hostname1, hostname2, and so on to be able to aggregate them. We opened a ticket with you guys a while ago and were told that there wasn't any way to aggregate different metrics, and we cannot change every piece of software that generates metrics for us... So we thought the ability to remove prefixes before sending the metrics to datadog would be a nice way of dealing with that. Cheers, |
@remh any chance to see this merged ? Indeed a lot of reporting tools do not allow the prefix to be changed (or "namespaced"). |
@scalp42 can you rebase your branch against master ? There are some conflicts. I'll merge it after. |
fixed the conflicts. |
@remh ping :) |
ping! :) |
@remh can you look at it again please? 📆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really ashamed of the time it took us to review this. My most sincere apologies. This looks almost ready to go to me @tiadobatima, I would perhaps change the config option a little bit to make it less confusing regarding its purpose.
@@ -13,6 +13,14 @@ A plugin to connect etsy's statsD to Datadog | |||
datadogApiKey: "your_api_key" // You can get it from this page: https://app.datadoghq.com/account/settings#api | |||
datadogPrefix: "your_prefix" // Your metrics will be prefixed by this prefix | |||
datadogTags: ["your:tag", "another:tag"] // Your metrics will include these tags | |||
datadogRemovePrefix: 2 // Number of period delimited prefixes to remove. If you use this option with *datadogPrefix* remove will happen prior to addition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is a bit of a misleading name, maybe datadogMetricKeyTrim
- so that the purpose of the variable is a little bit more clear in that it acts over the key, and that it's a trim operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: also might be nice to check the variable is indeed a number
@@ -192,11 +193,14 @@ var flush_stats = function datadog_post_stats(ts, metrics) { | |||
}; | |||
|
|||
var get_prefix = function datadog_get_prefix(key) { | |||
var new_key = key; | |||
if (datadogRemovePrefix !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (datadogRemovePrefix !== undefined) { | |
if (datadogRemovePrefix !== undefined) && (typeof datadogRemovePrefix == "number") { |
No description provided.