---
title: Ignore or include Prometheus metrics
source: https://docs.newrelic.com/docs/infrastructure/prometheus-integrations/install-configure-openmetrics/ignore-or-include-prometheus-metrics
---

Avoid sending Prometheus OpenMetrics integration data that is not relevant to your monitoring needs. Instead, use filters to ignore or include specific metrics. This will help you control the amount and types of data you send to New Relic. This will also help you avoid additional billing charges, as explained in this document.

## Prevent billing increases [#rate-limits]

We use the Prometheus `discovery` and `scrape` annotations. If you set the Prometheus OpenMetrics integration to scrape **all** the available targets and to send all the data that's exposed from those targets, you may exceed New Relic's platform limits and increase your billing charges. To help prevent this from happening, use the integration's filtering capabilities.

For more information, see the Prometheus OpenMetrics integration requirements for [Docker](https://docs.newrelic.com/docs/integrations/prometheus-integrations/get-started/monitor-prometheus-new-relic#OpenMetrics). Also see the [troubleshooting procedures for `NrIntegrationError` events](https://docs.newrelic.com/docs/integrations/prometheus-integrations/troubleshooting/rate-limit-errors-prometheus-integration).

## Identify metrics to ignore or include [#ignore-metrics]

To decide what data to include or exclude, use New Relic's [Metric API](https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/metric-api/view-query-you-metric-data#explore-metric-data) to explore your metric data. Then, refine your filters to scrape only relevant targets and send useful metrics.

-   To filter out unwanted metrics from a target, use the `ignore_metrics` configuration option.
-   To filter out targets instead of the metrics, use the `scrape_enabled_label` configuration option.

> #### ⚠️ CAUTION
>
> The [histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) and [summary](https://prometheus.io/docs/concepts/metric_types/#summary) metrics type filtering apply to the `base name`. You can't filter by the `_bucket`, `_sum`, or `_count` time series for that metric.

The [`nri-prometheus-latest.yaml`](https://download.newrelic.com/infrastructure_agent/integrations/kubernetes/nri-prometheus-latest.yaml) manifest file includes the `nri-prometheus-cfg` config map showing an [example configuration](https://docs.newrelic.com/docs/integrations/prometheus-integrations/configure/configure-prometheus-openmetrics-integration). The integration will ignore or include metrics before executing the other functions to [add, rename, or copy attributes](https://docs.newrelic.com/docs/integrations/prometheus-integrations/view-query-data/add-rename-copy-prometheus-attributes).

**Filter out unwanted metrics (ignore)**

To ignore unwanted metrics, use the following transformation.

Example configuration

To drop all metrics that start with `go_` or `process_`:

````yml
transformations:
  - description: "General processing rules"
    ignore_metrics:
      - prefixes:
        - "go_"
        - "process_"
```

Example of raw Prometheus metrics

```promql
go_goroutines 13
process_virtual_memory_bytes 2.062336e+07
mysql_global_status_commands_total{command="ha_close"} 0
mysql_global_status_commands_total{command="ha_open"} 0
```

This is taken from the MySQL exporter. Besides the MySQL metrics, it also exposes metrics about the exporter that may not be of interest to you.

Example output

After filtering has been applied, the `go_` and `process_` metrics are dropped and the `mysql_` metrics are shipped to New Relic.

```promql
mysql_global_status_commands_total{command="ha_close"} 0 
mysql_global_status_commands_total{command="ha_open"} 0
```

````

**Include only specific metrics (except)**

If you only want to include specific metrics, you can use the `except` list under the `ignore_metrics` section. As the name implies, this will ignore all the metrics except the ones that contain the with the given prefixes.

Example configuration:

To drop all metrics except `kube_hpa_`:

````yml
transformations:
  - description: "General processing rules"
    ignore_metrics:
      - except:
        - kube_hpa_
```

````

**Combination of include and exclude (except and ignore)**

You can combine both `prefixes` and `except` under the `ignore_metrics` section for more complex filtering.

**Example configuration**

To drop all `coredns_` metrics, except for `coredns_dns_request_count_total` and `coredns_dns_responses_total`:

````yml
transformations:
  - description: "CoreDNS Example Metrics"
    ignore_metrics:
      - prefixes:
          - coredns_
        except:
          - coredns_dns_request_count_total
          - coredns_dns_responses_total
```

````
