I have a simple rpc call with configured retrying that should fail with error UNAVAILABLE. At the DEBUG level in logs I can see that request was sent exactly N times as it should.
serviceStub.sayHello(request)
How can I extract the number of retries occured while this rpc call?
I tried extracting headers but seems like there is no value for retries count
As mentioned in the gRFC A6, the metatdata
grpc-previous-rpc-attemptsis set in the request headers for the server to see. And grpc-java does set it in the response headers for the client to see.So for client side, you could adapt the metadata example: