Skip to content
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

Remove mut self reference from LogExporter::export() method. #2380

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Dec 4, 2024

Changes

As discussed here - #2374 (comment)
The changes are minimal, and the stress test for the logs now includes an exporter call over the future, causing a slight regression.

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 December 4, 2024 00:44
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 15.78947% with 16 lines in your changes missing coverage. Please review.

Project coverage is 79.4%. Comparing base (957659f) to head (4fff54b).

Files with missing lines Patch % Lines
opentelemetry-stdout/src/logs/exporter.rs 0.0% 7 Missing ⚠️
opentelemetry-otlp/src/exporter/tonic/logs.rs 0.0% 5 Missing ⚠️
opentelemetry-appender-tracing/src/layer.rs 0.0% 1 Missing ⚠️
opentelemetry-otlp/src/exporter/http/logs.rs 0.0% 1 Missing ⚠️
opentelemetry-otlp/src/logs.rs 0.0% 1 Missing ⚠️
opentelemetry-sdk/src/logs/log_processor.rs 66.6% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2380   +/-   ##
=====================================
  Coverage   79.4%   79.4%           
=====================================
  Files        123     123           
  Lines      21479   21484    +5     
=====================================
+ Hits       17064   17068    +4     
- Misses      4415    4416    +1     

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

@cijothomas
Copy link
Member

cijothomas commented Dec 4, 2024

I think this is the right direction. Our processors are only requiring self and not mut self, so there seems to be no strong reason for exporter methods to require mut self. Also looked at tracing-subscriber - its on_event method is also just requiring self , and it lets layers manage its state via interior mutability.

Requiring mut self would prevent exporters's export() method from being called in parallel. While this is a spec requirement now, we expect to allow exporters to be called parallel in certain situations. Instead of adding another trait for that, it seems okay to use self itself and let exporters handle state via interior mutability, if they need to.

Would love to get more feedback on this, as we are close to declaring stability, so can't make breaking changes after that.

@cijothomas cijothomas added the integration tests Run integration tests label Dec 4, 2024
@lalitb
Copy link
Member Author

lalitb commented Dec 4, 2024

agree, would prefer to have closer on this sooner, the slight regression seen in stress test can then be evaluated to improve with #2374.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration tests Run integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants