feature: refactor and extend `log_exporter` benchmark
Design discussion issue: #2031
Changes
This commit refactors and extends the log_exporter benchmark.
- Rename to be more precise:
FooWithFuturebecomesFooAsyncTrait,FooWithoutFuturebecomesFooSync - Add variant using native Rust support for async traits
- Share workload code between implementations
- Use blackbox hint for implementations under test
- Expand module documentation
- Move each impl into its own submodule
Merge requirement checklist
- [x] CONTRIBUTING guidelines followed
- [x] Unit tests added/updated (if applicable): N/A
- [x] Appropriate
CHANGELOG.mdfiles updated for non-trivial, user-facing changes: N/A - [x] Changes in public API reviewed (if applicable): N/A
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 79.0%. Comparing base (
99d24b7) to head (de4ee51). Report is 167 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2143 +/- ##
=====================================
Coverage 79.0% 79.0%
=====================================
Files 121 121
Lines 20945 20945
=====================================
Hits 16561 16561
Misses 4384 4384
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@demurgos Thanks in advance for your patience! I am clearing my backlog and will get to this soon!
@lalitb Can you help continue this?
@lalitb Can you help continue this?
Had a quick look. The impl Future approach is indeed much faster (around ~8 times faster in my local tests), which makes sense as it uses static dispatch with future type is known at compile time and so avoids overhead of heap allocations and dynamic dispatch that comes with using Pin<Box<dyn Future>> or async-trait. However, it requires Rust 1.75 or newer since impl Trait in traits was only stabilized in that version. Since our current msrv is 1.71, we can't use this approach without updating our Rust version.
Before going forward, it's good to discuss if we should bump-up our msrv to 1.75 for otel-sdk, and all exporters.
Closing this, as we have a PR already open to make this happen : https://github.com/open-telemetry/opentelemetry-rust/pull/2374