Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[processor/probabilisticsampler] fix panic when sampling on non-Bytes log record attribute #18223
[processor/probabilisticsampler] fix panic when sampling on non-Bytes log record attribute #18223
Changes from 4 commits
95b6348
ef9b02f
a6d440d
1b2e1e5
b94921e
5634904
9374049
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 could do with some input here.. I'm not sure if we should be handling string types without understanding the encoding. See PR discussion for more context.
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 would say that this doesn't matter much, as a hash will be calculated based on the value. If it's string or int, it doesn't matter, as long as they are all converted to bytes in the end. Additionally, it doesn't matter if we are using the right encoding for the string, as long as all values are byte encoded in the same way. If we were to use this information for other than just calculating a hash, it would certainly be important to properly handle the encoding.
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.
In this case the user has configured a log record attribute that is not a supported type. Unfortunately, the
RemoveIf
functions used by this processor don't return errors, so I figure the only sane thing here without a bigger refactor is to log something. IsWARN
the appropriate severity for a misconfigured processor?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 guess the only value that should not be supported is boolean. Otherwise, the probability provided by the user will be skewed by the fact that booleans can only have two values: there won't be a good distribution of values to make a proper probability.
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 believe there is a method named,
AsString
which works regardless the type since it just callsfmt.Sprint
?Would that work here instead?