-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: collect shared logic for blob storage and minio #27
base: main
Are you sure you want to change the base?
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.
A little comment on this but not a blocker. Did you extract this code from any service (because another one needs to use it) or is it something several services will use in the future?
blobstorage/blobstorage.go
Outdated
|
||
if resp.StatusCode != http.StatusOK { | ||
body, _ := io.ReadAll(resp.Body) | ||
return fmt.Errorf("upload failed with status %d: %s", resp.StatusCode, string(body)) |
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.
nit: I'd add the body (even the status code) as a separate log. You want to keep errors that come from the same path as consistent as possible. That allows you, e.g., to group errors to see how frequent an incident is.
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 am not sure if I got it correctly.
Do you mean like this?
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.
Sort of, I'd align with the logger package we use in other repos:
err := fmt.Errorf("failed to upload file")
logger.Error("Failed to upload file to MinIO",
zap.Binary("body", body),
zap.Int("status", resp.StatusCode),
zap.Error(err),
)
return err
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 |
Yeah, my question was if this had been copied from somewhere (e.g. |
Because
This commit
Note