-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Replace GRPC InvalidCode with equivalent code from Http #33867
base: main
Are you sure you want to change the base?
Replace GRPC InvalidCode with equivalent code from Http #33867
Conversation
Signed-off-by: Juan Manuel Ollé <jolle@mulesoft.com>
@PiotrSikora Do I Understand correctly your comment? |
enumToInt(local_reply_data.grpc_status_ | ||
? local_reply_data.grpc_status_.value() | ||
: Grpc::Utility::httpToGrpcStatus(enumToInt(response_code))))); | ||
response_headers->setGrpcStatus(std::to_string(enumToInt( |
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.
I think you should gate the setGrpcStatus()
call on the presence of valid gRPC status.
If there is no valid gRPC status set, then grpc-status
shouldn't be set at all... and I don't believe your current change does that.
Also, I didn't follow Envoy's development for last couple of years, so I'm not sure if this is sufficient change.
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.
Understand, there is a mapping between http code and grpc equivalent code. legacy do the mapping in case not set. Just added invalidcode.
Lets see if a maintainer following this module closely think if here is the most suitable place to do it.
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.
Thanks for your contribution! Left a few minor comments.
You'll also need to add a release note.
One high-level question: why is gRPC InvalidCode needs a special treatment?
/wait
@@ -1034,6 +1034,26 @@ TEST(HttpUtility, SendLocalGrpcReplyGrpcStatusAlreadyExists) { | |||
Grpc::Status::WellKnownGrpcStatus::InvalidArgument, false}); | |||
} | |||
|
|||
TEST(HttpUtility, SendLocalGrpcReplyGrpcStatusInvalidCode) { |
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.
Please add a one-line comment describing the test.
? local_reply_data.grpc_status_.value() | ||
: Grpc::Utility::httpToGrpcStatus(enumToInt(response_code))))); | ||
response_headers->setGrpcStatus(std::to_string(enumToInt( | ||
local_reply_data.grpc_status_ && local_reply_data.grpc_status_.value() != |
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.
This change is user-facing and should be runtime-guarded.
Assigning Yan as this is a core-change. |
Also assigning Kuat as the PR relates to #33856. |
/wait |
@adisuissa Thanks for your quick reply
Sending -1 (InvalidCode) it is casted as unsigned big number (I'm using grpcurl). Does it has a special meaning for a client? Not sure. |
Should I continue with this change? does it make sense? |
I'm not a gRPC expert (and might be misunderstanding something here) but if cc @kyessenov who also reviewed #33856 |
Commit Message: common: Replace GRPC InvalidCode with equivalent code from Http
Additional Description: In case of the grpc status code is not set or an invalid code, envoy will set it with a code mapped from http code.
Risk Level: Low
Testing: yes
Docs Changes: no
Release Notes: no
Platform Specific Features: n/a