-
Notifications
You must be signed in to change notification settings - Fork 535
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
Correctly handle 400 Bad Request and 404 Not Found in gRPC streaming #4144
Conversation
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.
one comment to just add the logging logic to all the streaming handlers, but other than that lgTm
@@ -139,6 +139,8 @@ func logResult(logger log.Logger, tenantID string, durationSeconds float64, req | |||
statusCode := -1 | |||
if httpResp != nil { | |||
statusCode = httpResp.StatusCode | |||
} else if st, ok := status.FromError(err); ok { |
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.
is httpResp nil in this case?
we may also want to add this same logic to the other log methods
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.
The other handlers use a simpler logic that's not affected by that.
What this PR does:
Correctly handle 400 Bad Request and 404 Not Found in gRPC streaming.
Status codes in gRPC are changed to return
InvalidArgument
for 400 andNotFound
for 404. Other non-special HTTP status codes areUnknown
.This also allows fixing how 400 responses are counted towards SLO calculations.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]