-
Notifications
You must be signed in to change notification settings - Fork 1.2k
sdk/log: Deduplicate key-value collections in Record.SetBody #7002
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
base: main
Are you sure you want to change the base?
sdk/log: Deduplicate key-value collections in Record.SetBody #7002
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7002 +/- ##
======================================
Coverage ? 82.8%
======================================
Files ? 262
Lines ? 24362
Branches ? 0
======================================
Hits ? 20176
Misses ? 3811
Partials ? 375
🚀 New features to boost your workflow:
|
This is not a part of the specification. Doesn't adding this move up further away from the defined specification behavior? |
@MrAlias, what do you have in mind? "deduplication" of the key-values is part of the specification and it also involves Or are you concerned about the option added in #6968?
|
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.
nit comments
Co-authored-by: Robert Pająk <[email protected]>
@@ -170,7 +170,11 @@ func (r *Record) Body() log.Value { | |||
|
|||
// SetBody sets the body of the log record. | |||
func (r *Record) SetBody(v log.Value) { | |||
r.body = v | |||
if !r.allowDupKeys { | |||
r.body = r.dedupeBodyCollections(v) |
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.
What affect does this have on the performance of SetBody
?
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.
At this point of time we should do the deduplication anyway (to be compliant with the specification).
The performance benefit of not doing (when allowDupKeys
is true
) it is pretty irrelevant given we will remove this opt-in performance optimization probably in v1.39.0
. Therefore, I do not think it is worth adding a new benchmark. More here: #7002 (comment)
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 should likely be done in a lazy manner. Having performance information about the approach presented here will provide evidence to how critical that work is going to be.
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.
We have benchmarks for the same on log record attributes: #6968 (comment) this is also why I thought that maybe we do not more 😉
However, I think it would be easier and less-controversial to just add benchmarks for Record.SetBody
.
@Mojachieee, can you add them and add the results to the PR description?
With OTEP: Extending attributes to support complex values #4485 finally being merged (which was not certain at all) we most likely would not need this change as we will get rid of Still, I am fine having this PR merged as I think it is better to start changing the Logs API and SDK to use EDIT: I created #7034 |
Fixes #6982