Skip to content

Commit

Permalink
dedup the same collector tags
Browse files Browse the repository at this point in the history
Signed-off-by: luhualin <luhualin@bilibili.com>
  • Loading branch information
Betula-L committed Nov 27, 2020
1 parent 0642a85 commit fc6efe9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/collector/app/span_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,17 @@ func (sp *spanProcessor) processItemFromQueue(item *queueItem) {
}

func (sp *spanProcessor) addCollectorTags(span *model.Span) {
// TODO add support for deduping tags, https://github.com/jaegertracing/jaeger/issues/1778
dedupKey := make(map[string]struct{})
for _, tag := range span.Process.Tags {
if value, ok := sp.collectorTags[tag.Key]; ok && value == tag.AsString() {
dedupKey[tag.Key] = struct{}{}
}
}
// ignore collector tags if has the same key-value in spans
for k, v := range sp.collectorTags {
span.Process.Tags = append(span.Process.Tags, model.String(k, v))
if _, ok := dedupKey[k]; !ok {
span.Process.Tags = append(span.Process.Tags, model.String(k, v))
}
}
}

Expand Down

0 comments on commit fc6efe9

Please sign in to comment.