-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Log a warning when log Record attribute is dropped #5376
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MrAlias
added
pkg:SDK
Related to an SDK package
area:logs
Part of OpenTelemetry logs
labels
May 17, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5376 +/- ##
=====================================
Coverage 84.5% 84.5%
=====================================
Files 268 268
Lines 17808 17818 +10
=====================================
+ Hits 15064 15074 +10
Misses 2430 2430
Partials 314 314
|
MrAlias
requested review from
evantorrie,
XSAM,
dashpole,
MadVikingGod,
pellared,
hanyuancheung and
dmathieu
as code owners
May 17, 2024 19:17
dmathieu
reviewed
May 22, 2024
pellared
approved these changes
May 23, 2024
dmathieu
approved these changes
May 23, 2024
Co-authored-by: Robert Pająk <pellared@hotmail.com>
dashpole
approved these changes
May 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #5317
According to the specification, there should be a message printed in the SDK's log to indicate to the user that an attribute was discarded due to such a limit. To prevent excessive logging, the message must be printed at most once per
LogRecord
(i.e., not per discarded attribute).This change centralizes the
Record
dropped field writes and calls a global logging function. This will at most log once per anyRecord
dropping attributes, meeting the specification requirement.This does not log once per
Record
when an attribute is dropped. To do that we would need to maintain state within theRecord
(i.e.sync.Mutex
orsync.Once
). These types cannot be copied, meaning theRecord
would take on this "no copy" requirement. This seems too restrictive and with the permissive specification allowing a single log line, that is the solution added.