---
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](/docs/k6/latest/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](#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](/media/images/icons/icon-copy-small-2.svg) Copy

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