[log] proxy/handler: add debug logging to forwardAndReadBody and writeEmptyResponse#7066
Merged
Merged
Conversation
…Response Add 5 meaningful logHandler calls to two previously-unlogged helper functions: - forwardAndReadBody: entry (method+path), upstream error, body-read error, success (status+bodyLen) - writeEmptyResponse: chosen shape and status code These functions are called from every DIFC proxy request path. Without these logs it is impossible to distinguish a GitHub API failure from a response-read failure, or to understand why an empty shape was chosen when policy filters items. Reuses the existing logHandler variable declared in this file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds debug-level trace logging to previously opaque helper functions in the DIFC proxy handler, improving diagnosability of upstream request failures and empty-response shaping without changing proxy behavior.
Changes:
- Add debug logs to
forwardAndReadBodyfor entry, upstream-call failure, body-read failure, and success summary. - Add debug log to
writeEmptyResponseto record the selected empty JSON shape and upstream status.
Show a summary per file
| File | Description |
|---|---|
| internal/proxy/handler.go | Adds debug logging in forwardAndReadBody and writeEmptyResponse to improve request/response traceability in the proxy pipeline. |
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 Autofix powered by AI <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.
Adds 5
logHandlercalls to two previously-unlogged helper functions in the DIFC proxy pipeline.Changes
forwardAndReadBody(4 new log calls):methodandpathso every upstream request is traceableforwardToGitHubfails (previously only a 502 was emitted with no diagnostics)io.ReadAllfails mid-streamwriteEmptyResponse(1 new log call):[],{"data":null}, or{}) was selected and the upstream status code — useful when DIFC policy filters items and callers receive an empty responseWhy these functions?
forwardAndReadBodyis called from every code path inhandleWithDIFC. Before this change, a GitHub API failure appeared in logs only as a generic502with no indication of which method/path was involved or whether the failure was during the HTTP call or while reading the body.writeEmptyResponseis similarly opaque: there was no log entry explaining why a DIFC-filtered response took a particular empty shape.Validation
go build -o awmg .✅go vet ./...✅go test ./...✅ (all packages pass)logHandler = logger.New("proxy:handler")— no new logger declaration neededWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
index.crates.ioSee Network Configuration for more information.