---
title: Metrics
description: Run duration, success rate and run frequency per pipeline, with retention, aggregation, export and the two switches for collection.
---

Pipedash can turn completed runs into 3 metrics per pipeline and chart them. Collection stays off until enabled, and 2 separate settings control it. The chart icon on a workflow row opens the Metrics tab. The URL `/pipelines/<pipeline id>?tab=metrics` opens it too.

## Enabling metrics

<Screenshot src="metrics" alt="Metrics tab with duration, success rate and frequency charts" caption="The Metrics tab of a pipeline over 24 hours, grouped by hour." />

Metrics have an application switch and a global switch. They have different defaults.

| Setting | Where | Default |
|---|---|---|
| `general.metrics_enabled` | `config.toml` | `true` |
| `PIPEDASH_METRICS_ENABLED` | Environment | Unset |
| Enable metrics by default switch | Settings, Metrics section | Off |

- **Application switch:** `general.metrics_enabled` decides whether Pipedash starts the metrics service. When it is `false`, the REST metrics routes answer `Metrics service not available`. The [Configuration](/docs/configuration) page covers the config file.
- **Environment variable:** the current version does not read `PIPEDASH_METRICS_ENABLED` at startup. Only the `config.toml` key takes effect.
- **Global switch:** the Enable metrics by default switch decides whether pipelines without their own config record runs. It is off by default, so a fresh install has the service but records nothing.

The Metrics section of Settings holds the global switch and a Retention period menu. The menu offers 7, 14, 30, 60 and 90 days and Custom. Custom shows a Custom days field that accepts whole numbers of at least 1, with no maximum. 90 days is the largest preset. Each change saves at once, and a custom value saves when the field loses focus. The REST route is `PUT /api/v1/metrics/config`.

Each pipeline has its own config with an on or off state and a retention. A pipeline without its own config inherits both values from the global config. A pipeline with metrics off shows "Metrics are turned off for this pipeline" and an Enable metrics button.

The Configure metrics button on the Metrics tab opens a dialog titled `Configure metrics: <pipeline name>`. The dialog has these parts:

- **Collection settings:** an Enable metrics switch and a Retention period menu with the same presets.
- **Stored metrics:** the metric count of this pipeline, the count and size in MB for all pipelines, and the time of the last cleanup.
- **Delete pipeline metrics:** a button that asks for confirmation, then deletes the stored metrics of this pipeline.

Turning the switch off and saving asks for confirmation under the title "Disable metrics". The Disable and delete data button then deletes the stored metrics of that pipeline. Cancel and Save close the dialog.

Retention must be at least 1 day, and a smaller value returns `Retention days must be at least 1`. Turning metrics on again makes Pipedash read the old runs once more.

## What Pipedash records

Pipedash extracts metrics from runs that finished with status `success`, `failed`, `cancelled` or `skipped` inside the retention window.

For ordinary runs, Pipedash processes up to 200 new runs per batch. It keeps the processed position below the oldest unfinished run. A run that finishes after a newer run still counts. A `degraded` run counts as unfinished: it adds no metric and holds the processed position until its status changes.

FluxCD's native reconciliation history uses a separate path. Pipedash refreshes metrics for retained history records when their contents change. Current-state snapshot rows add no metrics. The status `degraded` adds no metrics.

| Metric type | Value per run | Rule |
|---|---|---|
| `run_duration` | Seconds | Recorded whenever the run has a duration, including skipped runs. |
| `success_rate` | 100 or 0 | 100 for `success`, 0 for `failed` and `cancelled`. Skipped runs record none. |
| `run_frequency` | 1 | One per run. Skipped runs record none. |

Each entry stores the status, branch and actor. Repeated reads do not add duplicate metrics for a run. An updated native reconciliation record replaces its stale metric values.

Extraction runs in the background after run history loads. An open Metrics tab also refreshes when later runs change the pipeline or generate metrics. The tab does not need to be reopened.

## Periods and aggregation

The chart groups values by period and applies an aggregation to each group.

| Setting | Values |
|---|---|
| Periods | `hourly`, `daily`, `weekly`, `monthly` |
| Aggregations | `avg`, `sum`, `min`, `max`, `p95`, `p99` |
| Chart time ranges | Today, 24 hours, 7 days, 30 days, 60 days, 90 days |

The Metrics tab shows one card per metric with the latest and the average value. The cards use `avg` for duration and success rate and `sum` for frequency. The Group by menu offers Hourly, Daily, Weekly and Monthly. The Time range menu disables ranges longer than the pipeline's retention and marks them "(beyond retention)". The URL keeps `dateRange` (default `24h`) and `period` (default `hourly`).

A period without runs between two periods with runs shows as a gap in the duration and success rate charts, not as zero. The latest and average values skip it. The frequency chart shows such a period as 0 and counts it in the average.

A click on a card opens a larger chart with a data table. Its Time range, Group by and Aggregation menus apply to that chart only. The Aggregation menu lists Average, Total, Minimum, Maximum, 95th percentile and 99th percentile. A range without runs shows "No runs in this time range".

The data table sorts by Date, the metric value, Count, Min or Max. Choosing the same column cycles through ascending, descending and the original order. On mobile, a sort menu provides the same choices.

Selecting a chart point or a table row highlights that period. Selecting the row again clears the selection.

## Export

The larger chart has an Export menu with two entries, "Export as PNG" and "Export as CSV". The menu stays disabled until the chart has data and finishes loading. It exports the chart as the menu settings show it.

| Format | Content |
|---|---|
| PNG | An image of the chart at twice the screen resolution, on the background color of the theme. |
| CSV | One row per period with the columns Timestamp, Date, Value, Count, Min, Max and Avg. The Value header names the unit, for example `Value (seconds)`. |

The file name is `<pipeline>_<metric type>_<time range>` plus `.png` or `.csv`. Characters other than letters and digits in the pipeline name become `_`. The desktop app opens a save dialog and the browser downloads the file. A notification titled "Chart exported" or "Data exported" confirms it. A failure shows "Couldn't export PNG" or "Couldn't export CSV".

## Retention and cleanup

Pipedash cleans up metrics on startup and then every 6 hours. Cleanup deletes entries older than the retention of each pipeline, or the global default when the pipeline has no config. The [Refresh](/docs/features/refresh) page covers the loop that runs the cleanup.

## Storage and flush

Metrics live in the main database. Settings, in the Cache section, shows the metrics entry count when it is above 0.

A storage migration with the Transfer data option keeps metrics. It copies the global and pipeline metrics settings, the metric rows and the processing state to the new storage. Each pipeline's rows follow the new provider id. Rows of deleted providers stay behind, and a repeat migration does not duplicate rows. The migration summary shows how many metric entries it copied.

| Action | REST route |
|---|---|
| Read global config | `GET /api/v1/metrics/config` |
| Read or set pipeline config | `GET` and `PUT /api/v1/metrics/pipelines/{id}/config` |
| Query chart data and statistics | `POST /api/v1/metrics/dashboard` |
| Storage stats | `GET /api/v1/metrics/storage/stats` |
| Delete metrics | `POST /api/v1/metrics/flush` |

Storage stats return the entry count, the estimated size in bytes and MB, the last cleanup time and a count per pipeline. A flush deletes the metrics of one pipeline. Without an id it deletes them for all pipelines. Pipedash then reads the old runs again.

The dashboard request accepts these fields:

| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| `pipeline_id` | String | No | Unset | Limits the query to one pipeline. |
| `metric_type` | String | Yes | None | `run_duration`, `success_rate` or `run_frequency`. |
| `aggregation_period` | String | Yes | None | `hourly`, `daily`, `weekly` or `monthly`. |
| `aggregation_type` | String | No | `avg` for duration and success rate, `sum` for frequency | `avg`, `sum`, `min`, `max`, `p95` or `p99`. |
| `date_range` | String | Yes | None | `today`, `24h`, `7d`, `30d`, `60d` or `90d`. |
| `utc_offset_minutes` | Integer | No | `0` | The client's UTC offset in minutes. It determines the start of `today`. |
| `limit` | Non-negative integer | No | Unset | Optional result limit. |
| `table_sort` | Object | No | Unset | A `field` and `direction` for the data table. |

The table sort fields are `timestamp`, `value`, `count`, `min` and `max`. The directions are `asc` and `desc`.

The response includes aggregated values, observation flags, summary statistics, table row ordering and the available time ranges.

Invalid filter values return a client error. Pipedash does not replace an unknown metric type, time range, grouping period or aggregation with a default.
