-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 bug: Use Content-Length for bytesReceived and bytesSent tags in Logger Middleware in v2 #3067
Conversation
WalkthroughRecent changes to the logger middleware in the Go-Fiber framework address an issue causing out-of-memory errors when downloading large files. These modifications involve adjusting how content length is computed and logged, and updating related test cases to match the new expectations. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- middleware/logger/logger_test.go (2 hunks)
- middleware/logger/tags.go (2 hunks)
Additional comments not posted (6)
middleware/logger/tags.go (3)
5-5
: LGTM!The import of the
strconv
package is appropriate for converting integers to strings.
89-89
: LGTM!Using
strconv.Itoa
to convert the content length to a string is a correct approach.Ensure that the function handles cases where the content length is not set or is zero.
92-92
: LGTM!Using
strconv.Itoa
to convert the content length to a string is a correct approach.Ensure that the function handles cases where the content length is not set or is zero.
middleware/logger/logger_test.go (3)
389-389
: LGTM!Setting the content length to 5 is necessary to test the updated
TagBytesSent
function.
396-396
: Update expected output.The expected output has been correctly updated to "-2 5 200" to reflect the changes in the
TagBytesSent
function.Ensure the test covers all relevant cases, including when the content length is not set.
633-633
: Update expected output.The expected output has been correctly updated to "-2 -1 200" to reflect the changes in the
TagBytesSent
function.Ensure the test covers all relevant cases, including when the content length is not set.
Description
Content-Length
header when calculating thebytesSent
andbytesReceived
tags in the Logger Middleware.Fixes #3060
Type of change