Skip to content

Commit

Permalink
remove agent type receiver from trace agent obfuscateStatsGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgopack4 committed Dec 11, 2024
1 parent 3c882e7 commit df12504
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/trace/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ func (a *Agent) processStats(in *pb.ClientStatsPayload, lang, tracerVersion, con
if !a.Blacklister.AllowsStat(b) {
continue
}
a.obfuscateStatsGroup(b)
obfuscator := a.lazyInitObfuscator()
obfuscateStatsGroup(obfuscator, b)
a.Replacer.ReplaceStatsGroup(b)
group.Stats[n] = b
n++
Expand Down
4 changes: 1 addition & 3 deletions pkg/trace/agent/obfuscate.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ func (a *Agent) obfuscateSpan(span *pb.Span) {
}
}

func (a *Agent) obfuscateStatsGroup(b *pb.ClientGroupedStats) {
o := a.lazyInitObfuscator()

func obfuscateStatsGroup(o *obfuscate.Obfuscator, b *pb.ClientGroupedStats) {
switch b.Type {
case "sql", "cassandra":
oq, err := o.ObfuscateSQLString(b.Resource)
Expand Down
3 changes: 2 additions & 1 deletion pkg/trace/agent/obfuscate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ func TestObfuscateStatsGroup(t *testing.T) {
} {
agnt, stop := agentWithDefaults()
defer stop()
agnt.obfuscateStatsGroup(tt.in)
obfuscator := agnt.lazyInitObfuscator()
obfuscateStatsGroup(obfuscator, tt.in)
assert.Equal(t, tt.in.Resource, tt.out)
}
}
Expand Down

0 comments on commit df12504

Please sign in to comment.