Skip to content

Conversation

@cijothomas
Copy link
Member

@cijothomas cijothomas commented Feb 20, 2025

TODO: Tests in next PR, if this is merged.

Follow up from https://github.com/open-telemetry/opentelemetry-rust/pull/2001/files

@cijothomas cijothomas requested a review from a team as a code owner February 20, 2025 01:28
@cijothomas
Copy link
Member Author

@mladedav Could you also review this?

@codecov
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.3%. Comparing base (5ce50ae) to head (da6e16b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-appender-tracing/src/layer.rs 83.3% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2689     +/-   ##
=======================================
- Coverage   79.3%   79.3%   -0.1%     
=======================================
  Files        123     123             
  Lines      22602   22601      -1     
=======================================
- Hits       17927   17925      -2     
- Misses      4675    4676      +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// to optimize sync exporter scenario.
self.log_record
.add_attribute(Key::new(field.name()), AnyValue::from(value.to_owned()));
if field.name() == "message" {
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

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 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)

Copy link
Member Author

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 behavior if both message attribute and default body field is provided

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.

Copy link
Member Author

@cijothomas cijothomas Feb 20, 2025

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 error to 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.

Copy link
Member

@lalitb lalitb Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were already special casing "message" for the record_debug, so missing this may also be considered a bug

Yes, I didn't realize that. With special casing, user can't have both explicit and implicit string message attributes, as they would be overwritten. But this PR doesn't add any new bug :)

Copy link
Member Author

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...

@cijothomas cijothomas merged commit 19dba69 into open-telemetry:main Feb 21, 2025
21 checks passed
@mladedav
Copy link

Sorry for the late response but yeah, it seems fine.

@cijothomas cijothomas deleted the cijothomas/appender-mesage branch February 21, 2025 15:06
@cijothomas
Copy link
Member Author

Sorry for the late response but yeah, it seems fine.

Thanks!

bantonsson pushed a commit to bantonsson/opentelemetry-rust that referenced this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants