-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 support for datadog distributions metric #8179
Add support for datadog distributions metric #8179
Conversation
Awesome! Thanks @ppsreejith. We currently have a backlog of PR reviews for our next 1.16 release which we want out soon. We'll get this reviewed shortly after. |
@sjwang90 as v1.16 went out approx one month ago, I am wondering whether you have an ETA for merging this nice feature into the master branch. Thank you |
plugins/inputs/statsd/statsd.go
Outdated
fields := make(map[string]interface{}) | ||
fields[m.field] = m.floatvalue | ||
cached := cacheddistributions{ | ||
name: m.name, | ||
fields: fields, | ||
tags: m.tags, | ||
} |
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.
You are always setting just one field, why do you use a map for this? You could also store the name and value instead of allocating over and over.
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.
So I updated the cacheddistributions
interface and replaced field with value. The repeated allocation now happens in the Gather
method where the accumulator's addFields
requires a map argument.
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.
Have some comments in the code, nothing big. Please also add the new option to the sampleConfig
variable!
@ppsreejith any news? |
@srebhan Sorry for the (really) long pause (Life's been hectic 😅). I've some time now so I'll pick this up this week 👍 |
6ad36e0
to
0b298bb
Compare
@srebhan I've addressed the above comments 👍 Let me know if there are more changes.
Do you mean the |
Also, small side note: I set up a playground to make it easier to test out Telegraf changes end-to-end (In case this makes it easier for others). |
@ppsreejith to be honest I can't remember what I meant with
:-) However, as you add new fields it might be good to give the user a chance to enable or disable the new field(s). We want to keep the output series stable between versions by default. Is there a way to enable/disable the distribution fields? If not, could you please add a flag to the config where those fields are disabled by default!? |
@srebhan Got it. I'll add this 👍 |
81ca641
to
06dff47
Compare
@srebhan I've added a new config flag The distributions metric will only be parsed if both the I've documented this config in the |
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.
Thank you very much for your effort! Looks good to me!
* Add support for datadog distributions in statsd * Parse metric distribution correctly * Add tests to check distributions are parsed correctly * Update Statsd plugin Readme with details about Distributions metric * Refactor metric distribution initialization code * Update distribution metric interface to replace fields with value * Refactor statsd distribution metric test code * Fix go formatting errors * Add tests to parse only when DataDog Distributions config is enabled * Add config to enable parsing DataDog Statsd Distributions * Document use of datadog_distributions config in Readme
Required for all PRs:
Thanks for the awesome work you folks do :)
This PR is my attempt to add support for the distributions metric (alternate link) to maintain compatibility with Datadog metrics. This would allow us to aggregate metrics on the server rather than on the agent (i.e. aggregate on Influx rather than on Telegraf).
I've added unit tests and tested this on my local Influx and Telegraf setup. Let me know of all the changes required 👍
Closes #8134