-
Notifications
You must be signed in to change notification settings - Fork 599
Appender-Tracing - extend spl treatment of message when recording str #2689
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
Merged
cijothomas
merged 6 commits into
open-telemetry:main
from
cijothomas:cijothomas/appender-mesage
Feb 21, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b5d0aed
Appender-Tracing - extend spl treatment of message when recording str
cijothomas 4f684c0
Merge branch 'main' into cijothomas/appender-mesage
lalitb ff45706
Merge branch 'main' into cijothomas/appender-mesage
cijothomas 90a60fe
Merge branch 'main' into cijothomas/appender-mesage
cijothomas cf6ee43
Merge branch 'main' into cijothomas/appender-mesage
cijothomas da6e16b
Merge branch 'main' into cijothomas/appender-mesage
cijothomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,32 @@ | |
| Fixes [1682](https://github.com/open-telemetry/opentelemetry-rust/issues/1682). | ||
| "spec_unstable_logs_enabled" feature now do not suppress logs for other layers. | ||
|
|
||
| The special treatment of the "message" field has been extended when recording | ||
| string values. With this change, when a log is emitted with a field named | ||
| "message" (and string value), its value is directly assigned to the LogRecord’s | ||
| body rather than being stored as an attribute named "message". This offers a | ||
| slight performance improvement over previous. | ||
|
|
||
| For example, the below will now produce LogRecord with the message value | ||
| populated as LogRecord's body: | ||
|
|
||
| ```rust | ||
| error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", message = "This is an example message"); | ||
| ``` | ||
|
|
||
| Previously, Body was only populated when the below style was used. | ||
|
|
||
| ```rust | ||
| error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message"); | ||
| ``` | ||
|
|
||
| This style, while slightly slower, should still be used when the value is not a | ||
| simple string, but require format arguments as in the below example. | ||
|
|
||
| ```rust | ||
| error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message with format arguments {} and {}", "foo", "bar"); | ||
| ``` | ||
|
|
||
| ## 0.28.1 | ||
|
|
||
| Released 2025-Feb-12 | ||
|
|
||
This file contains hidden or 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
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.
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 would be a breaking change if user is expecting the message to go an attribute?
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.
And what should be the expected behaviour if both message attribute and default body field is provided
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.
There was no contract documented about this, so while this change behavior, I don't think it should be a major issue. (We were already special casing "message" for the record_debug, so missing this may also be considered a bug)
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 can add tests to make sure this is covered, but the behavior is really controlled by tracing itself. We can make some decision and document it in the event of conflict, as there can only be one body.
Uh oh!
There was an error while loading. Please reload this page.
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.
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-appender-tracing/src/layer.rs#L121 Fixing these TODOs are also going to change the behavior, so is fixing
errorto be reported specially. It's questionable to do that post 1.0 stable (but maybe okay), but I don't see an issue doing it at this stage. Let me know your thoughts.Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, I didn't realize that. With special casing, user can't have both explicit and implicit string
messageattributes, as they would be overwritten. But this PR doesn't add any new bug :)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 need to document the final behavior before 1.0.
#2150 will also be related to this...