linkedin / ambry

Distributed object store
https://github.com/linkedin/ambry/wiki
Apache License 2.0
1.75k stars 276 forks source link

Use client error when client closed connection #2868

Closed justinlin-linkedin closed 3 months ago

justinlin-linkedin commented 3 months ago

Summary

When client closes the connection while downloading a blob, we will set the error response status to InternalServerError and then increment a GetBlobServerError counter in ContainerMetrics. But this is not a server error, this is a client.

This PR fixes this discrepancy. We will set error response status to client error so later it won't be counted as server error.

Operations

This would likely to impact two operations, GetBlobOperation and PutOperation. For GetBlobOperations, it should be fine, since the client already closes the connection, and we already send back 200 or 206 before, so it won't affect the status code of this response. This is just for internal metric tracking. For PutOperations, it should be fine too, since client closing connection without sending all the byte should be considered as bad request, instead of 503. This will reduce the number of 503 in public access log.

Test

Unit test

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 70.09%. Comparing base (52ba813) to head (fdc7950). Report is 78 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2868 +/- ## ============================================ + Coverage 64.24% 70.09% +5.85% - Complexity 10398 11778 +1380 ============================================ Files 840 851 +11 Lines 71755 72537 +782 Branches 8611 8728 +117 ============================================ + Hits 46099 50847 +4748 + Misses 23004 19062 -3942 + Partials 2652 2628 -24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.