-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[v2][WIP] Span hash sanitizer and enhance span hash adjuster #6499
base: main
Are you sure you want to change the base?
Changes from 1 commit
30a77bf
08c316e
26ef195
c674268
72b9b14
26e312b
c6d70f8
79b0d92
1df80c1
ddb966b
464a124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2022 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package sanitizer | ||
|
||
import ( | ||
"bytes" | ||
"encoding/hex" | ||
|
||
"github.com/jaegertracing/jaeger/model" | ||
) | ||
|
||
// NewHashingSanitizer creates a sanitizer to add hash field to spans | ||
func NewHashingSanitizer() SanitizeSpan { | ||
return hashingSanitizer | ||
} | ||
|
||
func hashingSanitizer(span *model.Span) *model.Span { | ||
// Check if hash already exists | ||
for _, tag := range span.Tags { | ||
if tag.Key == "span.hash" { | ||
return span | ||
} | ||
} | ||
|
||
buf := &bytes.Buffer{} | ||
if err := span.Hash(buf); err != nil { | ||
return span | ||
} | ||
|
||
hashStr := hex.EncodeToString(buf.Bytes()) | ||
span.Tags = append(span.Tags, model.KeyValue{ | ||
Key: "span.hash", | ||
VType: model.ValueType_STRING, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hard to evaluate this PR without seeing how it will be used in the storage backends. For example, is it really a string we want, or a number? |
||
VStr: hashStr, | ||
}) | ||
|
||
return span | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ type SanitizeSpan func(span *model.Span) *model.Span | |
func NewStandardSanitizers() []SanitizeSpan { | ||
return []SanitizeSpan{ | ||
NewEmptyServiceNameSanitizer(), | ||
NewHashingSanitizer(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: we also have v2 sanitizers, need to add this logic that as well.
|
||
} | ||
} | ||
|
||
|
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.
and similarly file name
add_hash_tag