-
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
String replacer function to strings plugin #4686
String replacer function to strings plugin #4686
Conversation
merge upstream master
@danielnelson i added a bit more than just the substring replacement in this PR since we need the ability to run a replace on every metric going through, but i'd imagine '*' should be fairly contained since it's likely not a valid name for the existing tags/fields/metrics 🤞 . If you can take a look that'd be awesome. Thanks! |
if c.Dest != "" { | ||
dest = c.Dest | ||
for tag, value := range tags { | ||
dest := tag |
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.
Maybe reuse tag
in place of dest
, to save an allocation.
if fv, ok := fv.(string); ok { | ||
metric.AddField(dest, c.fn(fv)) | ||
for tag, value := range fields { | ||
dest := tag |
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.
Again, just use tag
instead of dest
Required for all PRs:
In reference to #4599
Adding the ability to replace substrings in a field, tag, or measurement. Also adding the ability to
match on multiple of the resource with '*'. With that active, the
dest
field is ignored and the same data is written back to the same field name to avoid writing all modified data to the same field name.