Commit af26058
authored
[log] Add debug logging to circuit breaker (#4582)
Adds 4 focused debug log calls to `internal/server/circuit_breaker.go`
using the existing `logCircuitBreaker` logger (`server:circuit_breaker`
namespace).
## Changes
**File modified:** `internal/server/circuit_breaker.go`
### New logging calls
| Location | Message |
|----------|---------|
| `newCircuitBreaker` | Logs creation with `serverID`, `threshold`, and
`cooldown` so you can see CB config at startup |
| `Allow` (HALF-OPEN branch) | Logs when a probe is already in flight
and the request is being rejected |
| `RecordSuccess` | Logs when the consecutive error counter is reset
(only when it was > 0, avoids noise on healthy paths) |
| `parseRateLimitResetFromText` | Logs the parsed reset duration and
absolute timestamp when a reset time is extracted from error text |
## Validation
- `go build ./...` ✅
- `go vet ./...` ✅
- `go test ./internal/server/...` ✅
## Enable these logs
```bash
DEBUG=server:circuit_breaker ./awmg --config config.toml
```
> [!WARNING]
> **1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
160 | 165 | | |
161 | 166 | | |
162 | 167 | | |
| |||
314 | 319 | | |
315 | 320 | | |
316 | 321 | | |
317 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
318 | 325 | | |
0 commit comments