You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pre-req to #2386 which proposes to change default to use dedicated thread, and then make blocking calls to networking libraries.
However, tonic requires a tokio runtime to function.
But, based on our testing, it is seen that tonic client captures/stores the tokio runtime at creation time, and subsequently, gRPC methods can be called from non-tokio context as well (i.e from the normal std::thread)
See #2142 (comment)
This issue is opened to validate that the above is valid, and add integration tests to validate it, and also add doc comments/examples/readme as relevant.
cijothomas
changed the title
Validate tonic can be used in blocking scenarios
Validate tonic can be used in blocking scenarios/non-tokio context
Dec 9, 2024
Pre-req to #2386 which proposes to change default to use dedicated thread, and then make blocking calls to networking libraries.
However, tonic requires a tokio runtime to function.
But, based on our testing, it is seen that tonic client captures/stores the tokio runtime at creation time, and subsequently, gRPC methods can be called from non-tokio context as well (i.e from the normal std::thread)
See #2142 (comment)
Have done some tests to validate this behavior in separate repo:
https://github.com/cijothomas/async-explore/blob/main/src/client-no-tokio.rs
This issue is opened to validate that the above is valid, and add integration tests to validate it, and also add doc comments/examples/readme as relevant.
An example content in readme/doc:
When using OTLP with gRPC/tonic, provider(tracer/meter/logger) creation must be done in a tokio runtime, which is required for tonic for function. If your app uses tokio::main, then no further action required. Otherwise, ensure providers are created inside a tokio runtime.
Example: https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-otlp/examples/basic-otlp#basic-otlp-exporter-example
The text was updated successfully, but these errors were encountered: