-
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
#4699 Improve how the datadog plugin uses Metric.Fields and Metric.Tags #4803
Conversation
plugins/outputs/datadog/datadog.go
Outdated
@@ -76,6 +76,10 @@ func (d *Datadog) Write(metrics []telegraf.Metric) error { | |||
|
|||
for _, m := range metrics { | |||
if dogMs, err := buildMetrics(m); err == nil { | |||
tagMap := m.Tags() | |||
metricTags := buildTags(tagMap) |
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.
This is much better but if you want to take it even further you could use TagList() to build the tags list. TagList is always sorted so you can avoid the sort as well.
Tests should pass if you add the changes made by |
@danielnelson Thanks for the feedback! I made the changes that you suggested for |
Required for all PRs:
@danielnelson This PR addresses the feedback in #4699. I replaced the use of
Metric.Fields
withMetric.FieldList
and reduced how oftenMetric.Tags
is called (it didn't look like usingTagList
made sense)Since the changes were internal, I left the existing tests as is.