Commit 80ecf22
authored
[log] feat(httputil): add debug logging to HTTP utility functions (#4324)
Add a `logHTTP` debug logger (`httputil:httputil`) and meaningful
logging calls to the three utility functions in
`internal/httputil/httputil.go`.
## Changes
**File modified:** `internal/httputil/httputil.go` (1 file, focused PR)
### Logger added
```go
var logHTTP = logger.New("httputil:httputil")
```
### Logging calls added
| Function | What's logged |
|---|---|
| `WriteJSONResponse` | Status code, serialised body size, and marshal
errors |
| `ParseRateLimitResetHeader` | Parsed reset timestamp (RFC 3339) or
parse failure |
| `IsTransientHTTPError` | Status code when a transient error is
detected |
## Why this is useful
These helpers are called across the `server` and `proxy` packages.
Having debug output here makes it straightforward to trace:
- Which status codes are being written to clients
- Whether `X-RateLimit-Reset` headers are being parsed correctly
(relevant to the circuit-breaker reset logic)
- When the gateway decides a backend response is transient and eligible
for retry
Enable with:
```bash
DEBUG=httputil:* ./awmg --config config.toml
```
## Validation
- `go build ./...` ✅
- `go vet ./internal/httputil/...` ✅
- `go test ./internal/httputil/...` ✅
> Generated by [Go Logger
Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/24761251508/agentic_workflow)
· ● 2M ·
[◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests)
<!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot,
model: auto, id: 24761251508, workflow_id: go-logger, run:
https://github.com/github/gh-aw-mcpg/actions/runs/24761251508 -->
<!-- gh-aw-workflow-id: go-logger -->1 file changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
23 | 37 | | |
24 | 38 | | |
25 | 39 | | |
| |||
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| 48 | + | |
34 | 49 | | |
35 | 50 | | |
36 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
37 | 54 | | |
38 | 55 | | |
39 | 56 | | |
40 | 57 | | |
41 | 58 | | |
42 | | - | |
| 59 | + | |
43 | 60 | | |
44 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
45 | 66 | | |
0 commit comments