Menu
Open source
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.
JavaScript
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
Additional helpful documentation, links, and articles:
Video
Performance testing and observability in Grafana Cloud
In this webinar, learn how Grafana Cloud k6 offers you the best developer experience for performance testing.
User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.