Skip to content

Commit

Permalink
apm: don't delete decision maker tag from span (#25485) (#25566)
Browse files Browse the repository at this point in the history
(cherry picked from commit adf6116)

Co-authored-by: Andrew Glaude <[email protected]>
  • Loading branch information
agent-platform-auto-pr[bot] and ajgajg1134 committed May 15, 2024
1 parent 49e9e91 commit 07d69be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/trace/agent/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ func setChunkAttributes(chunk *pb.TraceChunk, root *pb.Span) {
}

if _, ok := chunk.Tags[tagDecisionMaker]; !ok {
var set bool
for _, span := range chunk.Spans {
if dm, ok := span.Meta[tagDecisionMaker]; !set && ok {
// First span wins
if dm, ok := span.Meta[tagDecisionMaker]; ok {
chunk.Tags[tagDecisionMaker] = dm
set = true
break
}
delete(span.Meta, tagDecisionMaker)
// There are downstream systems that rely on this tag being on the span
// delete(span.Meta, tagDecisionMaker)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/trace/agent/normalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ func TestTagDecisionMaker(t *testing.T) {
traceutil.SetMeta(chunk.Spans[2], tagDecisionMaker, "wrong")
setChunkAttributes(chunk, root)
assert.Equal("right", chunk.Tags[tagDecisionMaker])
assert.Equal("right", chunk.Spans[1].Meta[tagDecisionMaker])
}

func BenchmarkNormalization(b *testing.B) {
Expand Down

0 comments on commit 07d69be

Please sign in to comment.