-
Notifications
You must be signed in to change notification settings - Fork 683
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
fix prometheus interceptors not converting context errors to gRPC codes #571
fix prometheus interceptors not converting context errors to gRPC codes #571
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, could you make this change against v2? v1 is kinda maintenance mode.
d80851e
to
e4751c0
Compare
@johanbrandhorst - is this what you meant? (I didn't realise v2 branch was current given Edit: But how does that work with the releases for the prometheus interceptor - e.g. here it's against the main branch not v2 - from what I can tell. How will that work with the |
The unit & lint test checks don't run for some reason. Any chance one of the maintainers could take a look why that is? (I don't believe I have access to see.) |
@johanbrandhorst - apologies for the ping but it would be great to for this to be considered. The unit & lint test checks don't run for some reason (they do pass). Any chance you or one of the maintainers could take a look why that is? (I don't believe I have access to see/re-run the tests) |
Sorry to have missed this - we merged v2 into main so this should be targeted at main now. Please update again 😅. |
e4751c0
to
8779b13
Compare
8779b13
to
87b051a
Compare
note: Do not merge - the added failing test still shows the suite as passing (which obv. is wrong). I'll try to figure out what is wrong. |
- Previously context.(Canceled|DeadlineExceeded) would result in an "Unknown" grpc_code
87b051a
to
a5213e5
Compare
Ok, now it passes:
Ready for review |
Thanks for your contribution! |
First of all - thank you for a great library!
Changes
fix prometheus interceptors not converting context errors to gRPC codes
context.(Canceled|DeadlineExceeded)
would result in an "Unknown" grpc_code.We use the interceptors to not only track failures but also identify when we've accidentally passed back non-grpc errors. With this fix the context errors are correctly mapped to their gRPS status counterparts. This behaves the same as what happens in the golang server code. Something similar but old existed in your deprecated repo (grpc-ecosystem/go-grpc-prometheus#84) but it was never released nor did it make it across, it would appear.
Verification
Added unit test which triggers
context.Canceled
to verify it's no longer recorded asgrpc_code="Unknown"