Skip to content

feat: add prometheus breaker_state metric#20

Merged
cadgerfeast merged 3 commits intomainfrom
feat/prometheus_breaker_metrics
Apr 8, 2025
Merged

feat: add prometheus breaker_state metric#20
cadgerfeast merged 3 commits intomainfrom
feat/prometheus_breaker_metrics

Conversation

@cadgerfeast
Copy link
Collaborator

This one fixes #19 and adds a few metrics for circuit breakers, hopefully fixing #18.

Prometheus metrics added in this PR:

  • breaker_state: Works as an enum, it's actually three counters with a specific state label that can be closed | half-opened | opened, and is equal to 1 if active, or 0 otherwise.
  • failure_rate: A Gauge that is a percentage or current failures in the circuit.
  • slow_rate: A Gauge that is a percentage or current slow requests in the circuit.

@cadgerfeast cadgerfeast added bug Something isn't working enhancement New feature or request labels Apr 7, 2025
@cadgerfeast cadgerfeast requested a review from tichon29 April 7, 2025 15:37
@cadgerfeast cadgerfeast self-assigned this Apr 7, 2025
Copy link
Collaborator

@tichon29 tichon29 left a comment

Choose a reason for hiding this comment

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

Everything looks good to me.
Regarding my comment about Reset always returning 0, we could keep the return value to be coherent with what has been done for the inc method.

@cadgerfeast cadgerfeast merged commit a6d19c5 into main Apr 8, 2025
1 check passed
@cadgerfeast cadgerfeast deleted the feat/prometheus_breaker_metrics branch April 8, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BreakerMaxAllowedRequestError prototype

2 participants