-
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
Rename processor #4528
Rename processor #4528
Conversation
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.
Thanks for the PR, this will be very useful. I just have one comment on how we can improve the performance:
plugins/processors/rename/rename.go
Outdated
if newMeasurementName, ok := r.measurements[point.Name()]; ok { | ||
point.SetName(newMeasurementName) | ||
} | ||
for oldTagName, tagValue := range point.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.
We would want to use TagList() here instead of Tags() because it doesn't allocate, but what might be even better is if we skipped the initialization completely and just directly used the renamer
types:
for _, rule := range r.Tag {
value, ok := point.GetTag(rule.From)
if ok {
point.AddTag(rule.To, value)
}
}
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.
will do!
Required for all PRs:
This PR adds a processor plugin called "rename", which simply renames metrics, tags, or fields according to its configuration. It has unit coverage and the documentation has been updated with instructions on how to use it.
We need this functionality because both the
statsd
input andcloudwatch
output have hardcoded mutually inconsistent metric field names that we needed a simple way to harmonize.