-
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
sdk/log: Log when an attribute was discarded or truncated due to limits #5317
Labels
area:logs
Part of OpenTelemetry logs
enhancement
New feature or request
pkg:SDK
Related to an SDK package
Milestone
Comments
This comment was marked as resolved.
This comment was marked as resolved.
MrAlias
added a commit
that referenced
this issue
May 28, 2024
Fix #5317 According to the [specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logrecord-limits), 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 any `Record` 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 the `Record` (i.e. `sync.Mutex` or `sync.Once`). These types cannot be copied, meaning the `Record` 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. --------- Co-authored-by: Robert Pająk <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:logs
Part of OpenTelemetry logs
enhancement
New feature or request
pkg:SDK
Related to an SDK package
From https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logrecord-limits:
The text was updated successfully, but these errors were encountered: