let channel = ServiceBuilder::new()
.timeout(std::time::Duration::from_secs(10)) // <<< new layer
.layer(OtelGrpcLayer)
.service(channel);
and it doesn't compile, getting:
error[E0277]: the trait bound `tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>: Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>` is not satisfied
--> examples/grpc/src/client.rs:26:22
|
26 | let mut client = GreeterClient::new(channel);
| ^^^^^^^^^^^^^^^^^^ the trait `Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>` is not implemented for `tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>`
|
= help: the following other types implement trait `Service<Request>`:
<MakeBalance<S, Req> as Service<Target>>
<hyper_timeout::TimeoutConnector<T> as Service<Uri>>
<Balance<D, Req> as Service<Req>>
<GreeterServer<T> as Service<request::Request<B>>>
<tonic_tracing_opentelemetry::middleware::server::OtelGrpcService<S> as Service<request::Request<B>>>
<Pool<MS, Target, Req> as Service<Req>>
<Box<S> as Service<Request>>
<axum::error_handling::HandleError<S, F, ()> as Service<request::Request<B>>>
and 116 others
= note: required for `tower::timeout::Timeout<tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>>` to implement `Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>`
= note: required for `tower::timeout::Timeout<tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>>` to implement `GrpcService<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>`
error[E0599]: the method `say_hello` exists for struct `GreeterClient<Timeout<OtelGrpcService<Channel>>>`, but its trait bounds were not satisfied
|
::: /Users/vitaliy/github/tracing-opentelemetry-instrumentation-sdk/target/debug/build/examples-grpc-bf009df384ee5b81/out/helloworld.rs:19:5
|
19 | pub struct GreeterClient<T> {
| --------------------------- method `say_hello` not found for this struct
--> examples/grpc/src/client.rs:32:27
|
32 | let response = client.say_hello(request).await?;
| ^^^^^^^^^ method cannot be called on `GreeterClient<Timeout<OtelGrpcService<Channel>>>` due to unsatisfied trait bounds
|
::: /Users/vitaliy/github/tracing-opentelemetry-instrumentation-sdk/tonic-tracing-opentelemetry/src/middleware/client.rs:33:1
|
33 | pub struct OtelGrpcService<S> {
| ----------------------------- doesn't satisfy `_: Service<Request<UnsyncBoxBody<Bytes, Status>>>`
|
::: /Users/vitaliy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/timeout/mod.rs:19:1
|
19 | pub struct Timeout<T> {
| ---------------------
| |
| doesn't satisfy `<_ as Service<Request<UnsyncBoxBody<Bytes, Status>>>>::Response = Response<_>`
| doesn't satisfy `_: GrpcService<UnsyncBoxBody<Bytes, Status>>`
| doesn't satisfy `_: Service<Request<UnsyncBoxBody<Bytes, Status>>>`
|
note: trait bound `tower::timeout::Timeout<tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>>: GrpcService<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>` was not satisfied
--> /Users/vitaliy/github/tracing-opentelemetry-instrumentation-sdk/target/debug/build/examples-grpc-bf009df384ee5b81/out/helloworld.rs:35:12
|
33 | impl<T> GreeterClient<T>
| ----------------
34 | where
35 | T: tonic::client::GrpcService<tonic::body::BoxBody>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound introduced here
= note: the following trait bounds were not satisfied:
`<tower::timeout::Timeout<tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>> as Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>>::Response = response::Response<_>`
`tower::timeout::Timeout<tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>>: Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>`
`tonic_tracing_opentelemetry::middleware::client::OtelGrpcService<Channel>: Service<request::Request<http_body::combinators::box_body::UnsyncBoxBody<prost::bytes::Bytes, tonic::Status>>>`
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `examples-grpc` (bin "client") due to 2 previous errors
Hi,
I'm experimenting with examples and it looks like that composing of layer doesn't work (or I'm missing something). Basically updated client https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk/blob/774a9c44e800493e86ac38164c37a5c6b0cf4864/examples/grpc/src/client.rs#L21
by adding
timeout
layerand it doesn't compile, getting:
Am I missing something?