[log] feat(httputil): add debug logging to HTTP utility functions#4324
Merged
[log] feat(httputil): add debug logging to HTTP utility functions#4324
Conversation
Add a logger (httputil:httputil) and debug logging calls to the three utility functions in internal/httputil/httputil.go: - WriteJSONResponse: log status code, body size, and marshal errors - ParseRateLimitResetHeader: log parsed reset time or parse failures - IsTransientHTTPError: log when a transient error code is detected These helpers are called widely across the server and proxy packages, so debug logging here makes it easier to trace HTTP response behaviour and rate-limit handling during troubleshooting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a dedicated debug logger to internal/httputil and instruments the shared HTTP helper functions to emit useful debug traces when DEBUG=httputil:* (or similar) is enabled.
Changes:
- Introduces
logHTTP(httputil:httputil) as the package debug logger. - Adds debug logs to
WriteJSONResponse,ParseRateLimitResetHeader, andIsTransientHTTPErrorto surface status codes, parse results, and marshal failures.
Show a summary per file
| File | Description |
|---|---|
| internal/httputil/httputil.go | Adds a logger.New(...) debug logger and emits debug logs from the three core httputil helpers. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
logHTTPdebug logger (httputil:httputil) and meaningful logging calls to the three utility functions ininternal/httputil/httputil.go.Changes
File modified:
internal/httputil/httputil.go(1 file, focused PR)Logger added
Logging calls added
WriteJSONResponseParseRateLimitResetHeaderIsTransientHTTPErrorWhy this is useful
These helpers are called across the
serverandproxypackages. Having debug output here makes it straightforward to trace:X-RateLimit-Resetheaders are being parsed correctly (relevant to the circuit-breaker reset logic)Enable with:
DEBUG=httputil:* ./awmg --config config.tomlValidation
go build ./...✅go vet ./internal/httputil/...✅go test ./internal/httputil/...✅