-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[jaeger-v2] Implement UTF-8 sanitizer for OTLP #6078
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
default: | ||
sanitized = append(sanitized, []byte(v.Str())...) |
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'd like to get a second set of eyes on this. In v1, we casted the value to a lossy string and converted it to its byte representation. Is just doing v.str()
safe here?
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.
Write unit tests for different types and we will found out.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6078 +/- ##
==========================================
+ Coverage 96.92% 96.94% +0.02%
==========================================
Files 351 352 +1
Lines 16675 16724 +49
==========================================
+ Hits 16162 16213 +51
+ Misses 329 328 -1
+ Partials 184 183 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
) | ||
|
||
const ( | ||
invalidOperation = "InvalidOperationName" |
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.
Values don't match kebub-case from the other sanitizer
) | ||
|
||
const ( | ||
invalidOperation = "InvalidOperationName" |
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.
Also let's use "span name" term, not operation
span.SetName(invalidOperation) | ||
} | ||
|
||
serviceName, ok := span.Attributes().Get(string(otelsemconv.ServiceNameKey)) |
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.
Why do we need to special case service.name? Wouldn't it be handled generically as all other attributes?
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.
Also, service name is supposed to be defined at the resource level, not at individual spans.
|
||
if v.Type() == pcommon.ValueTypeStr && !utf8.ValidString(v.Str()) { | ||
sanitized := []byte(v.Str()) | ||
newVal := attributes.PutEmptyBytes(k) |
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 contradicts the comment above about modifying the attributes while iterating over them.
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.
@yurishkuro the comment was for modifying the keys of the map. is there anything wrong with modifying the value associated with a key?
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 don't know, the command is put(), it may depend on the implementation.
default: | ||
sanitized = append(sanitized, []byte(v.Str())...) |
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.
Write unit tests for different types and we will found out.
var utf8EncodingTests = []struct { | ||
name string | ||
key string | ||
value string |
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.
It seems if your tests only allow string values you cannot test other attribute types.
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Signed-off-by: Mahad Zaryab <[email protected]>
Which problem is this PR solving?
Description of the changes
How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:yarn lint
andyarn test