@@ -69,10 +69,7 @@ <h2>Failure Modes</h2>
6969 < td > HTTP 500</ td >
7070 < td >
7171 Returns a 500 error with
72- < code
73- > {"error":{"message":"Chaos: request
74- dropped","type":"server_error","code":"chaos_drop"}}</ code
75- >
72+ < code > {"error":{"message":"Chaos: request dropped","code":"chaos_drop"}}</ code >
7673 </ td >
7774 </ tr >
7875 < tr >
@@ -207,7 +204,7 @@ <h2>Per-Request Headers</h2>
207204 < span class ="str "> "Content-Type"</ span > : < span class ="str "> "application/json"</ span > ,
208205 < span class ="str "> "x-aimock-chaos-disconnect"</ span > : < span class ="str "> "1.0"</ span > ,
209206 },
210- < span class ="prop "> body</ span > : < span class ="fn "> JSON.stringify</ span > ({ < span class ="prop "> model</ span > : < span class ="str "> "gpt-4"</ span > , < span class ="prop "> messages</ span > : [{ < span class =" prop " > role </ span > : < span class =" str " > "user" </ span > , < span class =" prop " > content </ span > : < span class =" str " > "hello" </ span > } ] }),
207+ < span class ="prop "> body</ span > : < span class ="fn "> JSON.stringify</ span > ({ < span class ="prop "> model</ span > : < span class ="str "> "gpt-4"</ span > , < span class ="prop "> messages</ span > : [... ] }),
211208});</ code > </ pre >
212209 </ div >
213210
@@ -220,7 +217,7 @@ <h2>CLI Flags</h2>
220217 < div class ="code-block-header ">
221218 CLI chaos flags < span class ="lang-tag "> shell</ span >
222219 </ div >
223- < pre > < code > $ npx -p @copilotkit/aimock aimock --fixtures ./fixtures \
220+ < pre > < code > $ npx -p @copilotkit/aimock llmock --fixtures ./fixtures \
224221 --chaos-drop 0.1 \
225222 --chaos-malformed 0.05 \
226223 --chaos-disconnect 0.02</ code > </ pre >
@@ -242,55 +239,6 @@ <h2>CLI Flags</h2>
242239 </ div >
243240 </ div >
244241
245- < h2 > Proxy Mode</ h2 >
246- < p >
247- When aimock is configured as a record/replay proxy (< code > --record</ code > ), chaos applies
248- to proxied requests too — so a staging environment pointed at real upstream APIs
249- still sees the failure modes your tests expect. Chaos is rolled < em > once per request</ em > ,
250- after fixture matching, with the same headers > fixture > server
251- precedence.
252- </ p >
253- < table class ="endpoint-table ">
254- < thead >
255- < tr >
256- < th > Mode</ th >
257- < th > When upstream is contacted</ th >
258- < th > What the client sees</ th >
259- </ tr >
260- </ thead >
261- < tbody >
262- < tr >
263- < td > < code > drop</ code > </ td >
264- < td > Never — upstream not contacted</ td >
265- < td > HTTP 500 chaos body; upstream is not called</ td >
266- </ tr >
267- < tr >
268- < td > < code > disconnect</ code > </ td >
269- < td > Never — upstream not contacted</ td >
270- < td > Connection destroyed; upstream is not called</ td >
271- </ tr >
272- < tr >
273- < td > < code > malformed</ code > </ td >
274- < td > Called — post-response</ td >
275- < td >
276- Request proxies normally; the upstream response is captured, then the body is
277- replaced with invalid JSON before relay. The recorded fixture (if recording) keeps
278- the real upstream response — chaos is a live-traffic decoration, not a fixture
279- mutation.
280- </ td >
281- </ tr >
282- </ tbody >
283- </ table >
284- < p >
285- < strong > SSE bypass.</ strong > If upstream returns
286- < code > Content-Type: text/event-stream</ code > , aimock streams chunks to the client
287- progressively. By the time < code > malformed</ code > would fire, the bytes are already on the
288- wire — the chaos action cannot be applied. This bypass is observable via the
289- < code > aimock_chaos_bypassed_total</ code > counter (see Prometheus Metrics below) and a
290- warning in the server log, so a configured chaos rate doesn't silently drop to 0% on SSE
291- traffic. Streaming mutation is planned for a future phase.
292- </ p >
293-
294242 < h2 > Journal Tracking</ h2 >
295243 < p >
296244 When chaos triggers, the journal entry includes a < code > chaosAction</ code > field recording
@@ -306,7 +254,6 @@ <h2>Journal Tracking</h2>
306254 "path": "/v1/chat/completions",
307255 "response": {
308256 "status": 500,
309- "source": "fixture",
310257 "fixture": { "...": "elided for brevity" },
311258 "chaosAction": "drop"
312259 }
@@ -321,31 +268,15 @@ <h2>Journal Tracking</h2>
321268 < h2 > Prometheus Metrics</ h2 >
322269 < p >
323270 When metrics are enabled (< code > --metrics</ code > ), each chaos trigger increments the
324- < code > aimock_chaos_triggered_total</ code > counter, tagged with < code > action</ code > and
325- < code > source</ code > . < code > source="fixture"</ code > means a fixture matched (or would have,
326- before chaos intervened); < code > source="proxy"</ code > means the request was on the proxy
327- dispatch path.
271+ < code > aimock_chaos_triggered_total</ code > counter with an < code > action</ code > label:
328272 </ p >
329273
330274 < div class ="code-block ">
331275 < div class ="code-block-header "> Metrics output < span class ="lang-tag "> text</ span > </ div >
332276 < pre > < code > # TYPE aimock_chaos_triggered_total counter
333- aimock_chaos_triggered_total{action="drop",source="fixture"} 3
334- aimock_chaos_triggered_total{action="malformed",source="fixture"} 1
335- aimock_chaos_triggered_total{action="disconnect",source="proxy"} 2</ code > </ pre >
336- </ div >
337-
338- < p >
339- When a chaos action is rolled but can't be applied — today, only
340- < code > malformed</ code > on an SSE proxy response — the bypass is recorded in a
341- separate counter so operators can distinguish "chaos didn't roll" from "chaos rolled but
342- was bypassed":
343- </ p >
344-
345- < div class ="code-block ">
346- < div class ="code-block-header "> Bypass counter < span class ="lang-tag "> text</ span > </ div >
347- < pre > < code > # TYPE aimock_chaos_bypassed_total counter
348- aimock_chaos_bypassed_total{action="malformed",source="proxy",reason="sse_streamed"} 4</ code > </ pre >
277+ aimock_chaos_triggered_total{action="drop"} 3
278+ aimock_chaos_triggered_total{action="malformed"} 1
279+ aimock_chaos_triggered_total{action="disconnect"} 2</ code > </ pre >
349280 </ div >
350281 </ main >
351282 < aside class ="page-toc " id ="page-toc "> </ aside >
0 commit comments