-
Notifications
You must be signed in to change notification settings - Fork 455
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
[DRAFT] Add Custom Thread-Based Runtime for OpenTelemetry batch Processing #2390
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2390 +/- ##
=======================================
+ Coverage 79.3% 79.4% +0.1%
=======================================
Files 122 123 +1
Lines 21511 21808 +297
=======================================
+ Hits 17060 17318 +258
- Misses 4451 4490 +39 ☔ View full report in Codecov by Sentry. |
@@ -28,6 +28,7 @@ tokio = { workspace = true, features = ["rt", "time"], optional = true } | |||
tokio-stream = { workspace = true, optional = true } | |||
http = { workspace = true, optional = true } | |||
tracing = {workspace = true, optional = true} | |||
async-compat = { version = "0.2"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package is for marshalling async events from futures
runtime to tokio
/async-std
. Its dependency can be eliminated by integrating the necessary code from this package, as it appears to be relatively small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right long term direction - we expose the required methods in runtime traits, and provide implementations using std::thread (like this), tokio etc, and default to std::thread.
Hoping to make this the case after 1.0, once we get good confidence in all the trait methods we need.
Disclaimer - Not for review or merge. If this seems useful, we can keep this PR open - for someone to take it further to production ready in future (post 1.0 era :) )
Changes
This draft PR introduces a custom thread-based runtime for asynchronous task handling in the OpenTelemetry Rust SDK. It provides an alternative for users which don't want to take dependency on external frameworks like Tokio or Async-Std for batch processing, featuring a simple thread-based worker pool with interval and delay scheduling. Additionally, unit tests are included to demonstrate integration with common transport libraries - hyper, reqwest/reqwest-blocking. The implementation uses
futures_executor::block_on
andasync-compat
to marshal tasks into the required runtime. The latter is smaller crate, and relevant code can be incorporated inside the otel to remove the dependency. And also added an example for using this runtime impl within batch processor for logs.The purpose of this draft is to demonstrate the concept and implementation of a thread-based runtime tailored for OpenTelemetry logging. It is not intended for immediate approval or merging but can serve as a foundation for future enhancements.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes