-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix bad error log #7662
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?
Fix bad error log #7662
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7662 +/- ##
=======================================
- Coverage 86.1% 85.8% -0.4%
=======================================
Files 298 298
Lines 21721 21735 +14
=======================================
- Hits 18718 18657 -61
- Misses 2626 2633 +7
- Partials 377 445 +68
🚀 New features to boost your workflow:
|
Clarify log message fix for dropped key-value pairs.
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.
The new tests looks like created with help of GenAI. Can you check it there is no redundancy and try to minimize the amount of new tests? At the same time I do not want to increase the complexity of existing tests (I think it is better to have more tests then fewer that are more complex).
| log.String("h", "H"), | ||
| ), | ||
| wantDroppedAttrs: 10, | ||
| wantDroppedAttrs: 0, // Deduplication doesn't count as dropped |
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 is not included in the PR description, right?
I tried to add a changelog entry for it. Please double-check.
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's included in the last part (code clean-up), but if that's not clear, I can update the PR description without any problem.
| func (r *Record) setDropped(n int) { | ||
| logAttrDropped() | ||
| r.dropped = n | ||
| if n > 0 { |
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 is another fix that should have a changelog entry.
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.
Added to the changelog
|
@mexirica , are you able to address the comments? |
Hi, sorry for the delay, Will fix they |
Reduced the number of tests. If that's still not okay, I can clean up more. |
Fixes: #6983
This pull request enhances logging and error reporting in the log record attribute handling code, specifically around dropped attributes and duplicate key-value pairs. The main focus is to provide clearer warnings when key-value pairs are dropped due to duplication, and to ensure warnings are only logged when actual drops occur.
Improved logging and error handling for dropped attributes and duplicate keys:
logKeyValuePairDroppedwarning (usingsync.OnceFunc) to log a warning message when key-value pairs are dropped due to key duplication. This ensures that duplicate key drops are clearly reported.addDropped,setDropped) to only log attribute drop warnings when the number of dropped attributes is greater than zero, preventing unnecessary log spam.Enhancements to attribute deduplication logic:
logKeyValuePairDroppedin multiple places withinAddAttributes,SetAttributes, andapplyValueLimitsAndDedupto log a warning whenever key-value pairs are dropped due to duplication, ensuring better visibility into attribute handling issues.Code cleanup:
addDroppedafter deduplication, as the logging is now handled directly where drops occur.