# Metrics

Controls NATS server metrics collection from Control Plane.

warning

Setting a scrape interval too low will result in near constant scraping of the NATS cluster metrics and can lead to performance issues: many of the statistics require some level of locking within the NATS server to collect.

We recommend leaving the interval at the default 15 seconds, especially on busy clusters

note

`Scraper` is the Control Plane internal NATS metrics scraper. We recommend using this scraper type as it is more efficient than NATS `Surveyor` and allows sharing cached statistics across multiple Control Plane functions.

## Metrics configuration

| Key                               | Type                                            | Required | Default | Description                                            |
| --------------------------------- | ----------------------------------------------- | -------- | ------- | ------------------------------------------------------ |
| `default_scrape_interval_seconds` | int                                             | No       | 15      | How frequently to scrape NATS systems (global default) |
| `system_options`                  | map of `ID` : [System Options](#system-options) | No       | empty   | System specific metrics settings                       |

### System options

| Key                | Type | Required | Default   | Description                                                           |
| ------------------ | ---- | -------- | --------- | --------------------------------------------------------------------- |
| `scrape_interval`  | int  | No       | 15        | How frequently to scrape NATS systems                                 |
| `scraper_type`     | enum | No       | `scraper` | `scraper`, `surveyor`                                                 |
| `extended_metrics` | bool | No       | false     | Enable extended metrics reporting: JSZ stream and consumer statistics |

Example (YAML):

```
metrics:

  system_options:

    33QrKYunJQlHdbEypBSgjkziE3k:

      scrape_interval: 10

      scraper_type: scraper

      extended_metrics: true
```
