-
Notifications
You must be signed in to change notification settings - Fork 31
filters: apply replace rules only after obfuscation #477
Conversation
840b4fa
to
7fe4773
Compare
7fe4773
to
0f579af
Compare
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.
Few questions and comments, but from what I can see as a go newb it seems ok.
@@ -50,7 +48,8 @@ func (pt *processedTrace) getSamplingPriority() (int, bool) { | |||
type Agent struct { | |||
Receiver *HTTPReceiver | |||
Concentrator *Concentrator | |||
Filters []filters.Filter | |||
Blacklister *filters.Blacklister |
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.
Can I suggest Denylister instead?
rails/rails#33677
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'm more along the lines of the second comment in that thread.
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.
Still worth considering though.
cfg.ReplaceTags = []*config.ReplaceRule{{ | ||
Name: "resource.name", | ||
Re: regexp.MustCompile("AND.*"), | ||
Repl: "...", |
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 replacement is something that would normally break the parser for normalization, right?
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.
Possibly, although that wasn't the case being tested here. But you're right, this is yet another bug that is resolved by this change.
Fixes #462
Problem:
sql.query
tag created by the agent is also affected by the replace rules because it is a copy of the resulting resource. This change moves the replacer after obfuscation, when thesql.query
tag is already created, leaving the original (obfuscated) query visible to the user. This also makes more sense from a UX point of view because our users will want to provide regular expressions for replacements based on what they see in the UI, which is the post-obfuscation entry.Changes to
filter
package:Filter
interfaceresourceFilter
asBlacklister
tagReplacer
asReplacer
Changes to processor:
Replacer
andBlacklister
and run them in the correct order.Blacklister
early andReplacer
only after obfuscation.