> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Freshness

> Learn how to use the freshness test to detect when a data source stops receiving data

## Definition

The freshness test measures how long before the end of the evaluation window the data
source last received data. If you add filters to the test, only data matching them counts.
The result is shown as **Age**, in the unit you choose, and you set a threshold on it — for
example, that the data source received data within the last 6 hours.

Openlayer measures the age at the end of each
[evaluation window](/monitoring/evaluation-and-delay-windows), not when the test runs, so
re-running a past window gives the same result.

## Taxonomy

* **Task types**: LLM, tabular classification, tabular regression, text classification.
* **Availability**: <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip> only.

<Warning>
  This test is only available in monitoring mode, as it reads when data arrived
  in a monitored data source.
</Warning>

## Why it matters

* A data source that stops receiving data fails silently: most tests skip a window with no
  data, so nothing alerts you that traffic or a pipeline stopped.
* The freshness test turns "no data for too long" into a failing test, so you hear about an
  outage, a broken integration, or a stalled job as soon as it exceeds your tolerance.
* It needs no knowledge of your schema, which makes it a good default test on every
  monitored data source.

## Parameters

* **Unit**: the time unit the age and the threshold are expressed in — `minutes`, `hours`,
  `days`, or `weeks`. The age is fractional, so with `hours`, 90 minutes is `1.5`.

## How windows are evaluated

* **Empty windows still evaluate.** The age comes from the data source's ingestion history,
  not from the rows in the window, so a window with no data reports how long it has been
  since data last arrived.
* **Windows before any data arrived are skipped** with "No data received yet." When the test
  has filters, the message is "No data matching the filters received yet."
* **The age reflects when Openlayer received the data**, not timestamps inside it. To measure
  how recent the values in a datetime column are, use the
  [column freshness test](/tests/catalog/column-freshness).

## Automatic thresholds

The freshness test supports [automatic thresholds](/tests/test-configuration). Use an upper
bound — **Upper only** in the UI, or operator `<=` in `tests.json` — since a growing age is
what signals a problem. Freshness adjusts automatic thresholds in three ways:

* **The upper bound is never lower than one evaluation window.** A data source that streams
  constantly sits near an age of zero, and a bound that tight would fail on every short gap.
  For example, with a daily evaluation window and `hours` as the unit, the upper bound is at
  least `24`.
* **The test fails once a whole window passes without data, even before there is enough
  history to forecast.** Until then, the upper bound is one evaluation window, instead of the
  test passing by default.
* **An ongoing outage doesn't teach the forecast to expect it.** The windows since the data
  source last received data are left out of the history, so the bound doesn't grow along
  with the outage. Earlier gaps stay in, so a data source that syncs on a schedule still
  learns its rhythm.

## Unsupported data sources

The freshness test relies on Openlayer recording when each row arrives. On data sources where
that isn't recorded, such as tables connected from a data warehouse, the test is skipped with
"Freshness isn't supported for this data backend. Use column freshness to measure a datetime
column instead." Use the [column freshness test](/tests/catalog/column-freshness) on a column
that records when each row was written.

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the freshness test:

<CodeGroup>
  ```json Monitoring - Automatic threshold theme={null}
  [
    {
      "name": "Data source keeps receiving data",
      "description": "Fails when the age of the latest data exceeds the learned upper bound",
      "type": "integrity",
      "subtype": "freshness",
      "thresholds": [
        {
          "insightName": "freshness",
          "insightParameters": [{ "name": "unit", "value": "hours" }],
          "measurement": "freshness",
          "operator": "<=",
          "thresholdMode": "automatic"
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600,
      "delayWindow": 0,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
    }
  ]
  ```

  ```json Monitoring - Manual threshold theme={null}
  [
    {
      "name": "Data received within the last 6 hours",
      "description": "Fails when the data source hasn't received data for more than 6 hours",
      "type": "integrity",
      "subtype": "freshness",
      "thresholds": [
        {
          "insightName": "freshness",
          "insightParameters": [{ "name": "unit", "value": "hours" }],
          "measurement": "freshness",
          "operator": "<=",
          "thresholdMode": "manual",
          "value": 6
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600,
      "delayWindow": 0,
      "syncId": "96622fba-ea00-4e42-8f42-5e8f5f60805f"
    }
  ]
  ```
</CodeGroup>

## Related

* [Column freshness](/tests/catalog/column-freshness) — how recent the values in a datetime column are, available in development and monitoring.
* [Number of rows](/tests/catalog/row-count) — how much data arrived in a window, rather than when it last arrived.
* [Evaluation and delay windows](/monitoring/evaluation-and-delay-windows) — how windows are defined.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.