Skip to content

[log] Add debug logging to circuit breaker - #4582

Merged
lpcox merged 1 commit into
mainfrom
log/circuit-breaker-debug-logging-a0ba53f529a9596f
Apr 27, 2026
Merged

[log] Add debug logging to circuit breaker#4582
lpcox merged 1 commit into
mainfrom
log/circuit-breaker-debug-logging-a0ba53f529a9596f

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

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

DEBUG=server:circuit_breaker ./awmg --config config.toml

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Go Logger Enhancement · ● 5.4M ·

Add 4 meaningful debug log calls to internal/server/circuit_breaker.go:
- newCircuitBreaker: log creation with threshold and cooldown config
- Allow (HALF-OPEN): log when probe is already in flight, rejecting request
- RecordSuccess: log when consecutive error count is reset to 0
- parseRateLimitResetFromText: log when a reset time is parsed from text

These log calls improve observability for troubleshooting rate-limit
circuit breaker behaviour without duplicating existing operational logs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Apr 26, 2026
@lpcox
lpcox marked this pull request as ready for review April 26, 2026 22:27
Copilot AI review requested due to automatic review settings April 26, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional debug-level observability to the server rate-limit circuit breaker (internal/server/circuit_breaker.go) using the existing server:circuit_breaker debug logger namespace, to help diagnose configuration and state transitions during rate-limiting scenarios.

Changes:

  • Log circuit breaker creation (server ID, threshold, cooldown) at initialization.
  • Log additional circuit breaker state/flow details: HALF-OPEN probe rejection, consecutive error reset on success, and parsed rate-limit reset timing from error text.
Show a summary per file
File Description
internal/server/circuit_breaker.go Adds 4 debug log lines to improve visibility into circuit breaker creation, HALF-OPEN behavior, error counter resets, and parsed reset times.

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: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants