I am trying to implement GRPC interceptors on the client side of a GRPC request in typescript (not on the server). While I know that for the server we can refer to , I am looking for a solution from the caller's side.
These interceptors are intended to streamline common generic tasks like metric tracking with Prometheus and tracing with OpenTracing.
The grpc.Client
seems promising () since all GRPC clients must extend it. Has anyone successfully intercepted calls to functions like makeUnaryRequest
? Would it involve creating a custom class that extends the generated GRPC client and overrides makeUnaryRequest
?
I am hoping that there is a way to add interceptors as options, similar to what is available in Go: https://github.com/grpc-ecosystem/go-grpc-prometheus#client-side.
Thank you! Ankur