Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/testing-guides/injecting-faults-with-xk6-disruptor/first-steps.md (append .md) or send Accept: text/markdown to /docs/k6/latest/testing-guides/injecting-faults-with-xk6-disruptor/first-steps/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
xk6-disruptor first steps
xk6-disruptor is an extension that adds fault injection capabilities to k6.
It provides a Javascript API to inject faults such as errors and delays into HTTP and gRPC requests served by selected Kubernetes Pods or Services.
import { ServiceDisruptor } from 'k6/x/disruptor';
export default function () {
// Create a new disruptor that targets a service
const disruptor = new ServiceDisruptor('app-service', 'app-namespace');
// Disrupt the targets by injecting delays and faults into HTTP request for 30 seconds
const fault = {
averageDelay: '500ms',
errorRate: 0.1,
errorCode: 500,
};
disruptor.injectHTTPFaults(fault, '30s');
}Next steps
Explore the fault injection API
Visit the interactive demo environment.
Learn the basics of using the disruptor in your test project:
Was this page helpful?
Related resources from Grafana Labs

