Skip to content

Conversation

@lalitb
Copy link
Member

@lalitb lalitb commented Jan 24, 2025

Changes

The only way to create LogRecord outside the opentelemetry_sdk should be using Logger::create_log_record() method.
So,

  • Removed the Default implementation for LogRecord.
  • Added a crate-level constructor LogRecord::new.
  • Ensured LogRecord creation is restricted to Logger::create_log_record().
  • Updated tests to use LogRecord::new() or Logger::create_log_record() for record creation where applicable.

Note: It is not possible to make Default implementation private, so it was removed, and crate private constructor was added instead.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@lalitb lalitb requested a review from a team as a code owner January 24, 2025 05:53
@codecov
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 86.27451% with 7 lines in your changes missing coverage. Please review.

Project coverage is 77.8%. Comparing base (6a8db83) to head (fbd12e5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
opentelemetry-proto/src/transform/logs.rs 69.2% 4 Missing ⚠️
opentelemetry-sdk/src/logs/log_processor.rs 81.8% 2 Missing ⚠️
...y-sdk/src/logs/log_processor_with_async_runtime.rs 50.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2549   +/-   ##
=====================================
  Coverage   77.8%   77.8%           
=====================================
  Files        122     122           
  Lines      23030   23055   +25     
=====================================
+ Hits       17931   17952   +21     
- Misses      5099    5103    +4     

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

now:
`opentelemetry_sdk::logs::{ExportResult, LogBatch, LogExporter};`

- *Breaking* `opentelemetry_sdk::LogRecord::default()` method is removed.
Copy link
Member

Choose a reason for hiding this comment

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

  • Breaking opentelemetry_sdk::LogRecord::default() method is removed.
    Use Logger::create_log_record() method instead.

@cijothomas cijothomas merged commit 8a4e5ca into open-telemetry:main Jan 24, 2025
21 checks passed
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.

2 participants