Ocelot icon indicating copy to clipboard operation
Ocelot copied to clipboard

Circuit breaker not handling exception at end points even when ExceptionsAllowedBeforeBreaking is set.

Open anuviswan opened this issue 2 years ago • 0 comments

Expected Behavior / New Feature

As per the documentation of QoS functionality of Ocelot, it uses Polly to achieve Circuit Breaker among the other resilience features. From what I could understand, the following configuration should have triggered the circuit breaker after an endpoint raised exception more than 2 times.

"QoSOptions": {
        "ExceptionsAllowedBeforeBreaking": 2,
        "DurationOfBreak": 10000,
        "TimeoutValue": 2000
      }

Actual Behavior / Motivation for New Feature

However, it looked like the exception raised by the end points isn't handled by the circuit breaker. Please note that the Timeout works perfectly and triggers the circuit breaker as expected. However the case wasn't same with the ExceptionsAllowedBeforeBreaking.

Steps to Reproduce the Problem

  1. Create a route in the gateway with the above Qos configuration
  2. The specified Endpoint should raise an exception
  3. Raise the request for end point via the gateway.

The code sample in the following link demonstrates the issue Demo Code

Similiar problem is mentioned in the following Stackoverflow question too https://stackoverflow.com/questions/56851572/ocelot-qos-doesnt-break-circuit-when-n-number-of-exception-arises

Specifications

  • Version: Ocelot - 17.0.1, Ocelot.Provider.Polly 17.0.1

anuviswan avatar Jan 06 '22 15:01 anuviswan