Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: Expose circuit breaker's failure rate to OnCircuitOpenedArguments #2529

Open
stambunan opened this issue Feb 25, 2025 · 1 comment

Comments

@stambunan
Copy link

Is your feature request related to a specific problem? Or an existing feature?

I'm trying to add metrics and logs when the circuit breaker opens and would love to be able to log the circuit breaker failure rate.

We've set this up so it's configurable during runtime and currently, we're only logging when the failure ratio changes. However, it'll be nice to log this when the circuit is opened to validate the failure ratio is correct.

Describe the solution you'd like

Perhaps OnCircuitOpenedArguments can accept one more argument failureRatio and _behavior.FailureRate can be passed in.

var args = new OnCircuitOpenedArguments<T>(context, outcome, breakDuration, manual);

Additional context

No response

@martincostello
Copy link
Member

I think if we wanted to go down the route of emitting more fine-grained metrics of this nature, we'd have the health metrics code itself emit metrics, rather than try and try and expose the "live" numbers to you directly at the point the circuit's state changes.

Then you could just continuously monitor the failure ratio and could correlate events like open and close with that metric.

Otherwise I think things would start to get quite complicated trying to shuffle the metrics around as there's different circuit breaking implementations abstracted from the main strategy, which just deals with "someone said I should open/close", rather than why that decision was made.

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

No branches or pull requests

2 participants