OCAPI Hook Circuit Breaker 23.2
The Hook Circuit Breaker feature improves stability and saves processing time by protecting the system from high rates of hook failures. It tracks calls to each hook type individually.
How It Works
Each extension point type has its own circuit breaker instance that tracks the rate of failed executions for that hook. The circuit breaker can be in one of three states: closed, open, or half-open. Normally, itβs closed. If at any time, the 100 most recent calls to the hook include more than 50 failures, the following process is triggered:
- The circuit breakerβs status changes to
open
. This change is logged. - For 60 seconds, any calls to the failing extension point return an HTTP Status Code
503 (Service Unavailable)
with the fault typeHookCircuitBreakerException
. - After 60 seconds, the circuit breakerβs status changes to
half-open
. This change is logged. - The circuit breaker tracks the next 10 calls to the failing extension point. If more than 5 of them fail, return to step 1.
- The circuit breakerβs status changes to
closed
and it resumes tracking calls to the hook. This change is logged.
Troubleshooting Hook Failures
If your hook calls return 503 (Service Unavailable)
errors, use Log
Center to investigate the cause.
- In Business Manager, navigate to .
- In the Log Files section, click Log Center.
- Select the Day of Year.
- In the LCQL field, enter HookCircuitBreaker.
- In the query hits, look for a HookInvocationException entry and click its Stack Trace UUID link.
- In the stack trace, find the
Caused by
section. It can contain information about the cause of the hook failures. Some possible causes include:- The hook contains a remote call that never returns a response, causing the hook to time out. In this case, try making an asynchronous OCAPI call instead.
- The hook script contains errors. Fix the code and consider adding error handling measures.
For information on extension points and supported resources, see the Hooks topic.
X
OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.