Ignore my previous response... it was flawed.
The assertion doesn't block or ratelimit a client... it short circuits/blocks all policy inside the circuit breaker for a period of time.
Based upon your desire to have the policy continue to operate normally and only log the error... you may need to look at another approach, I am not sure that the circuit breaker is what you want.
For example you may be able to use the apply throughput quota assertion inside a block that handles routing failures... and then query the throughput quota if it exceeds 5 routing failures in the last minute, additional logging is generated.
If you still think apply circuit breaker is right for you (your more concerned with latency than routing failures), then I think you would need two routing assertions; one inside the breaker, and one that only runs after its triggered like so:
- At least one...
- Apply circuit breaker
- set circuit_broken = false
- route
- at least one
- all assertions...
- circuit_broken is false
- detailed logging of routing failure before circuit broken
- all assertions...
- circuit_broken is not false (aka true)
- route
- detailed logging for successful routing after circuit broken
- detailed logging of failed routing after circuit broken
So in this case, you might start logging if your backend latency exceeds 1000ms five times in a minute. Once the breaker clears, that extra logging stops and the original route is used.
I don't see any other way to continue routing to the backend while still using a circuit breaker the way you want.
Original Message:
Sent: Jan 14, 2025 01:35 PM
From: Hasan Akgoz
Subject: Circuit Breaker Implementation
Hi community,
We want to applied circuit breaker in some of our rest services. when the trigger circuit breaker assertion, I want to send only logs ( via syslogs ) . But I don't want the circuit breaker to block or rate limit the client. is that possible ? if possible, how should I fix the attached configuration?
Download
