Skip to content
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

Wrap an entire call/response chain in ZClientInterceptor #309

Open
frekw opened this issue Sep 23, 2021 · 1 comment
Open

Wrap an entire call/response chain in ZClientInterceptor #309

frekw opened this issue Sep 23, 2021 · 1 comment

Comments

@frekw
Copy link

frekw commented Sep 23, 2021

Hi!

I'm trying to write a (actually two) general ZClientInterceptor that adds metrics and tracing for any outgoing gRPC call for the zio-grpc client.

However, ZClientInterceptor today only allows me to modify the outgoing call, and I have no knowledge about when the call returns.

Ideally, I'd be able to register a wrapper that can follow the entire lifecycle of the call (ideally, in the tracing case, I'd also be able to control the execution in order to do something like Tracing.span(spanName)(outgoingCall) to ease integration with zio-telemetry).

sttp has some good examples of what such an interface can look like: https://sttp.softwaremill.com/en/latest/backends/wrappers/custom.html (wraps the entire execution) and https://sttp.softwaremill.com/en/latest/backends/wrappers/custom.html#listener-backend (reacts on events and allows one to propagate some state such as start time to measure execution duration).

@joroKr21
Copy link
Contributor

Another use case is to be able to set a deadline on the CallOptions based on the method descriptor. Currently that's not possible because the client call is already created so it's too late.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants