---
title: "View, query, and alert on outliers | Grafana Cloud documentation"
description: "This page explains how to analyze outlier detectors, query their metrics, and configure alerts that trigger when outliers are detected."
---

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

# View, query, and alert on outliers

After creating an outlier detector, you can access it from the **Outlier detection** page.

This page explains how to analyze outlier detectors, query their metrics, and configure alerts that trigger when outliers are detected.

## View the outlier detection

In the **Outlier detection** page, click on the row or **View** button. This page includes:

- The outlier detector settings
- The **Graph**, which displays all returned series and highlights series containing outliers
- A **Summary** section that identifies series with outliers. Click any series to highlight it in the graph.

[An example detecting pods that consume memory differently from other pods in the cluster.](/media/docs/grafana-cloud/machine-learning/screenshot-outlier-detector-pod-example.png)

> Tip
> 
> You can explore [this outlier detection example in Grafana Play](https://play.grafana.org/a/grafana-ml-app/outlier-detector/30c4bf27-bd0e-4b6b-a67c-6f96633210d5?tech=docs&pg=ml-examples&plcmt=callout-tip&cta=outlier-detector-view).

## Query the outliers

After creating an outlier detector, a new `<outlier_detector_metric_name>:outliers` metric is exposed in the `grafanacloud-ml-metrics` Prometheus data source.

The :outliers metric returns binary series indicating whether a series contains an outlier at a given moment:

- `1` indicates an outlier
- `0` indicates standard behavior

[](/media/docs/grafana-cloud/machine-learning/screenshot-query-outlier-metric.png)

### Metric labels

Similar to [forecast metric labels](/docs/grafana-cloud/machine-learning/machine-learning/forecasting/query-and-alerting/#metric-labels), outlier metrics include additional labels:

- `ml_algorithm`: The outlier detector algorithm
- `ml_job_metric`: The outlier detector metric name, equal to `<outlier_detector_metric_name>`
- `ml_job_name`: The outlier detector name
- `ml_forecast`: The value is `outlier` for outlier detectors
- `series`: The identifier of the series. It starts at `0` and increments for each returned series in the `<outlier_detector_metric_name>` metric.

Outlier metrics also include labels returned by the original detector query.

## Alerting on outliers

You can create alert rules in **Grafana Alerting** that query the `:outliers` metric to detect when series in the group behave differently from the rest.

> Note
> 
> Unlike forecasts, which [periodically refresh forecast metrics](/docs/grafana-cloud/machine-learning/machine-learning/forecasting/#retrain-forecasts), outlier detector metrics are refreshed on every query.

The following query fires an alert when any series in the group is detected as an outlier:

PromQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```promql
outlier_detector_metric_name:outliers
```

Query breakdown:

- `outlier_detector_metric_name:outliers` returns a binary series per group member: `1` when the series is an outlier, `0` otherwise
- The alert fires for each series returning `1`

*To learn how alert rules that return multiple series work, refer to the [Grafana Alerting documentation](/docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/) and the [multi-dimensional alerting example](/docs/grafana-cloud/alerting-and-irm/alerting/examples/multi-dimensional-alerts/).*

Another detection method is to alert when more than 10% of the group behaves differently. You can modify the alert rule query as follows:

PromQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```promql
(
  sum(outlier_detector_metric_name_:outliers) 
  / 
  count(outlier_detector_metric_name_:outliers)
) > 0.10
```

Query breakdown:

- `sum(outlier_detector_metric_name:outliers)` counts the number of series currently flagged as outliers
- `count(outlier_detector_metric_name:outliers)` counts the total number of series in the group
- Dividing the two returns the fraction of the group behaving as outliers
- `> 0.10` fires the alert only when more than 10% of the group are outliers

### Link alert rules to outlier detectors

You can create an alert rule in **Grafana Alerting** and associate it with an outlier detector by adding a custom annotation named `grafana-ml-outlier-detector-id` with the outlier detector ID as its value.

Alerts linked to outlier detectors are visible in the Outlier detection list:

[](/media/docs/grafana-cloud/machine-learning/screenshot-detector-with-alerts.png)
