fix(rpc): stop classifying expected gRPC responses as trace errors#1812
Merged
Mirko-von-Leipzig merged 1 commit intonextfrom Mar 20, 2026
Merged
fix(rpc): stop classifying expected gRPC responses as trace errors#1812Mirko-von-Leipzig merged 1 commit intonextfrom
Mirko-von-Leipzig merged 1 commit intonextfrom
Conversation
drahnr
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On devnet we regularly observe a spike of errors in our traces, all originating from
tower_http::trace::on_failure.TraceLayer::new_for_grpc()classifier treats every non-OkgRPC status code as a failure, which emitsERROR-level trace events. The errors include:RESOURCE_EXHAUSTED(code 8) — rate limiting working as intendedUNIMPLEMENTED(code 12) — security scanners probing non-existent RPC methodsUNKNOWN(code 2) — scanners probing paths like.env,.git/config,.aws/credentialsNone of these are actual server errors — they're either expected operational behavior (rate limiting) or client/scanner misbehavior.
Solution
Replace
TraceLayer::new_for_grpc()with a customizedGrpcErrorsAsFailuresclassifier that treats client-fault and expected-operational codes as successes:UnknownInvalidArgumentNotFoundResourceExhaustedUnimplementedThese responses are still returned to clients with the same gRPC status codes — the only change is that they no longer trigger
on_failure(ERROR-level) in traces, and instead flow throughon_response(DEBUG-level).Codes that remain classified as failures:
Internal,Unavailable,DataLoss,DeadlineExceeded,Cancelled,PermissionDenied,Unauthenticated.