opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

feature: refactor and extend `log_exporter` benchmark

Open demurgos opened this issue 1 year ago • 2 comments

Design discussion issue: #2031

Changes

This commit refactors and extends the log_exporter benchmark.

  1. Rename to be more precise: FooWithFuture becomes FooAsyncTrait, FooWithoutFuture becomes FooSync
  2. Add variant using native Rust support for async traits
  3. Share workload code between implementations
  4. Use blackbox hint for implementations under test
  5. Expand module documentation
  6. 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.md files updated for non-trivial, user-facing changes: N/A
  • [x] Changes in public API reviewed (if applicable): N/A

demurgos avatar Sep 24 '24 21:09 demurgos

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.

codecov[bot] avatar Sep 24 '24 21:09 codecov[bot]

@demurgos Thanks in advance for your patience! I am clearing my backlog and will get to this soon!

cijothomas avatar Oct 03 '24 22:10 cijothomas

@lalitb Can you help continue this?

cijothomas avatar Nov 21 '24 22:11 cijothomas

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

lalitb avatar Nov 26 '24 21:11 lalitb

Closing this, as we have a PR already open to make this happen : https://github.com/open-telemetry/opentelemetry-rust/pull/2374

cijothomas avatar Dec 18 '24 19:12 cijothomas