google/rpc/code.proto <https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto> has the HTTP mappings. Those are REST-centric and are for converting *to* HTTP status code. Multiple of them are obviously wrong for gRPC (e.g., NOT_FOUND→404) and multiple of them are... weak... mappings even with REST. They aren't used for gRPC as gRPC (currently) always uses 200 for RPC errors. (I would be interested in changing that, in particular for UNIMPLEMENTED, but it hasn't been a problem.)
http-grpc-status-mapping.md is the opposite. It is HTTP → gRPC status code. HTTP 429 could be mapped to RESOURCE_EXHAUSTED, but I don't think UNAVAILABLE is *bad*. There was some discussion on the PR about this specifically after it was merged: https://github.com/grpc/grpc/pull/4955#pullrequestreview-6858335 . The current mapping was trying to be "good enough," and was thought to be the first pass. I'm quite surprised it has been 8 years without *any* change. On Mon, Oct 7, 2024 at 7:09 AM Trustin Lee <trus...@gmail.com> wrote: > Hi, > > According to http-grpc-status-mapping.md > <https://github.com/grpc/grpc/blob/v1.66.2/doc/http-grpc-status-mapping.md>, > HTTP 429 Too Many Requests is translated into gRPC UNAVAILABLE rather than > RESOURCE_EXHAUSTED. However, at some point in the past, statuscodes.md > <https://github.com/grpc/grpc/blob/v1.23.1/doc/statuscodes.md> said > RESOURCE_EXHAUSTED. Is there any reason the gRPC team changed the > recommended mapping for HTTP 429 status? Why is UNAVAILABLE is better than > RESOURCE_EXHAUSTED for HTTP 429? > > I'm asking this question not only to solve my own curiosity, but also to > give a better answer to the bug report > <https://github.com/line/armeria/issues/5928> for Armeria's gRPC status > code mapping that merely follows what grpc-java does. > > Thanks, > T > > -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to grpc-io+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/24702a70-915d-41d5-a9a1-e477bfaf8a05n%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/24702a70-915d-41d5-a9a1-e477bfaf8a05n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oPQEZdi5VKzxs0PJAREHC-AwEayuC6OSxXZeD25pKO2QQ%40mail.gmail.com.