[#191] Refactor error handling and logging #221
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-http-gw#221
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "dkirillov/frostfs-http-gw:bugfix/191-correct-status-codes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #191
982ae32bc4
to1796dfb6c1
1796dfb6c1
tod4eb7fe86e
d4eb7fe86e
to224bc10667
WIP: [#191] Refactor error handling and loggingto [#191] Refactor error handling and logging@ -735,3 +735,3 @@
r.RedirectTrailingSlash = true
r.NotFound = func(r *fasthttp.RequestCtx) {
handler.ResponseError(r, "Not found", fasthttp.StatusNotFound)
handler.ResponseError(r, "Router Not found", fasthttp.StatusNotFound)
Router
->Route
224bc10667
to75328dd934
@ -320,0 +323,4 @@
| 400 | Some error occurred during object downloading. |
| 403 | Access denied. |
| 404 | Container or objects not found. |
| 409 | Can not upload object due to quota reached. |
We can't seem to get a status of 409 when downloading the archive.
@ -86,3 +61,2 @@
func logAndSendBucketError(c *fasthttp.RequestCtx, log *zap.Logger, err error) {
log.Error(logs.CouldNotGetBucket, zap.Error(err), logs.TagField(logs.TagDatapath))
func (h *Handler) reqLogger(ctx context.Context) *zap.Logger {
question: is this function intentionally not used here and here? It's just that if within the handler package we wrap the
utils.GetReqLogOrDefault(ctx, h.log)
function inreqLogger(ctx context.Context)
, don't we want to use it wherever possible?Just missed that
@ -136,0 +104,4 @@
case errors.Is(err, layer.ErrNodeNotFound):
return fmt.Sprintf("Tree Node Not Found:\n%v", err), fasthttp.StatusNotFound
case errors.Is(err, ErrGatewayTimeout):
return fmt.Sprintf("Gateway Timeout:\n%v", err), fasthttp.StatusGatewayTimeout
Should we also note in the API documentation the possibility of returning a 504 GatewayTimeout?
Then we probably should mention all codes (even this) for any endpoint 🤔
Regarding this - I was considering it from the point of view that we can catch quota overrun only when loading an object. And it seems that we can catch 504 in many places, but it is not mentioned in the documentation.
But I understand the idea, so let's leave it as it is now.
75328dd934
to138d9ec1a8
@ -122,4 +132,2 @@
ObjectNotFound = "object not found"
ReadObjectListFailed = "read object list failed"
CouldNotStoreFileInFrostfs = "could not store file in frostfs"
FailedToHeadObject = "failed to head object"
You moved it to datapath section because those logs are produced in
handler
package?Because it's error that I want to see if datapath request failed. Otherwise we don't understand much from logs
Overall LGTM