---
title: "Constructor | Grafana k6 documentation"
description: "xk6-disruptor: ServiceDisruptor constructor"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Constructor

The `ServiceDisruptor()` constructor creates a new instance of a [ServiceDisruptor](https://grafana.com/docs/k6/v2.3.x/testing-guides/injecting-faults-with-xk6-disruptor/xk6-disruptor/servicedisruptor/) class.

Expand table

| Parameter          | Type   | Description                                                                                                                                                                                        |
|--------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| service            | string | name of the service                                                                                                                                                                                |
| namespace          | string | namespace on which the service is defined                                                                                                                                                          |
| options (optional) | object | [options](https://grafana.com/docs/k6/v2.3.x/testing-guides/injecting-faults-with-xk6-disruptor/xk6-disruptor/servicedisruptor/constructor/#options) for controlling the behavior of the disruptor |

### Options

The following options control the creation and behavior of the `ServiceDisruptor`:

Expand table

| Attribute     | Type   | Description                                                                         |
|---------------|--------|-------------------------------------------------------------------------------------|
| injectTimeout | string | maximum time for waiting the disruptor to be ready in the target pods (default 30s) |

## Example

JavaScript ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
const disruptor = new ServiceDisruptor('my-service', 'my-namespace');
```
