Expand description
Fault injection plugin (fault-injection) — a faithful subset of Apache
APISIX’s fault-injection plugin for chaos/resilience testing.
Injects an artificial delay and/or an abort response into matching
requests. Both faults are gated independently by a percentage sample and
a vars condition (APISIX triple-array expressions, see crate::vars).
Early-exit wiring: an aborted request has the configured response
already written onto Context.response and exits through the node’s
error port with code FAULT_INJECTED; non-aborted requests continue
through the success port. Wire error to a pass-through path (e.g.
straight to client.in, or an error-handler that preserves the prepared
response) so the injected status/body reach the client, and wire success
to the rest of the pipeline. This deviates mechanically from APISIX (where
abort is a direct exit, not an error) because featherbit pipelines need a
distinct port for “stop here” versus “keep going”.
Structs§
- Abort
Rule 🔒 - Delay
Rule 🔒 - Fault
Injection Plugin - Injects delays and/or abort responses into matching requests.
Functions§
- parse_
headers 🔒 - Accepts
headersas a map ({name: value}) or as the UI editor’s array form ([{name, value}]); scalar values are stringified, other shapes are rejected. Header names are lowercased. - parse_
or_ 🔒vars - Parses the APISIX
varsshape for this plugin: an array whose items are each a full expression (OR-ed together). Two leniencies over the strict shape, both resolved at config load: - parse_
percentage 🔒 - Parses
percentageas an integer in0..=100. - roll_
percent 🔒 - Draws a pseudo-random number in
0..100. - sample_
hit 🔒 - APISIX
sample_hit: no percentage means always hit;0never hits and100always hits. - vars_
match 🔒 - True when
varsis unset, or when any expression in the list matches (APISIX ORs across thevarsitems and ANDs within each).