Circuit Breaker
Overview
The Circuit Breaker action helps maintain system reliability by rejecting requests when the error rate and request volume within a rolling window exceed defined thresholds. It pauses traffic temporarily to allow the system to recover and automatically re-evaluates upstream health before resuming.
Configuration Reference
The Traffic Policy configuration reference for this action.
Supported Phases
on_http_request
Type
circuit-breaker
Configuration Fields
error_thresholdfloatRequired
Threshold percentage of errors that must be met before requests are rejected. Must be a value between
0.0
and1.0
. Defaults to0.5
.volume_thresholdinteger
Number of requests in a rolling window before checking the error threshold. Must be a number between
1
and2,000,000,000
. Defaults to10
.window_durationduration
Number of seconds in the rolling window that metrics are retained for. Must be a value between
1s
and2m
. Defaults to10s
.tripped_durationduration
Number of seconds the system waits after rejecting a request before re-evaluating upstream health. Must be a value between
1s
and2m
. Defaults to10s
.num_bucketsinteger
Number of buckets that metrics are divided into within the rolling window. Fixed at
10
.enforceboolean
Determines if the circuit breaker is active. If
false
, the circuit breaker never trips, and no requests are rejected. Defaults totrue
.
Examples
Basic Example
This example configuration sets up an endpoint (hotdog.ngrok.io
) that allows only 1 request every 60 seconds and trips the circuit breaker for 2 minutes.
Example Traffic Policy Document
- YAML
- JSON
Loading…
Loading…
Start Endpoint with Traffic Policy
Loading…
Helper script
Loading…
Loading…
Action Result Variables
The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.
This action does not set any variables after it has been executed.