Value Range

Detects numeric values of a field that are outside an accepted range.

The Value Range monitor checks that the values of a numeric field stay within a range you define.

When to Use

  • Business rules: An amount must be greater than 0 and less than or equal to 10,000.
  • Sign checks: An amount field, such as a payment amount, must be positive.
  • Unit errors: A conversion bug multiplies amounts by 100, and values far above the usual range appear.

To detect abnormal changes in an aggregate of the field (for example, its average) rather than in individual values, use Metrics.

How It Works

For each data point, Sifflet counts the rows where the field value is outside the accepted range, and computes:

  • Count (default value mode): The number of out-of-range rows.
  • Percentage: The share of out-of-range rows among the rows checked for the data point, in percent. These are the rows of the period in incremental scan mode (for example, all the rows created that day), or all the rows of the table in full dataset scan mode. Rows excluded by the where clause are not counted.

Null values are not counted as out of range. To detect them, use Nulls.

The default static threshold fails when the data point is greater than 0, that is, as soon as one value is out of range.

Example

You want every order total to be greater than 0 and less than or equal to 10,000. Create a Value Range monitor on orders with the following settings:

  • Column to monitor: order_total.
  • Acceptable value range is...: Between, Greater than 0 and Less than or equal to 10000.
  • Monitoring mode: Incremental scan, with created_at as the time window column and a daily time-based data aggregation.
  • Threshold: Static, Greater than 0 (default).

On June 10, a currency conversion bug multiplies the totals of the orders from one country by 100, and 85 orders get a total above 10,000. The data point of June 10 is 85, greater than 0, so the monitor fails.

Configure the Monitor

Value Range Settings

SettingDescriptionDefault
Column to monitorThe numeric field to check.None
Acceptable value range is...Greater than a minimum, Less than a maximum, or Between a minimum and a maximum. For each bound, choose whether the bound value itself is accepted (for example, Greater than or equal to).None

Common Settings

  • Value mode: Count (default) or Percentage.
  • Threshold: Static (default), relative, or dynamic. See Thresholds.
  • Scan mode: Incremental or full dataset. See Scan Modes.
  • Where clause and group by: See Where Clause, Group By, and Joins.
  • Joins: Join a second dataset to filter or group by its fields. See Joins.

Monitor as Code

The monitor kind is ValueRange. The following YAML creates the monitor of the example:

kind: ValueRange
field: order_total
range:
  min: 0
  isMinInclusive: false
  max: 10000
timeWindow:
  field: created_at
  firstRun: P365D
  frequency: P1D
ParameterRequiredDescription
fieldYesThe numeric field to check.
range.minNo (one bound required)The minimum accepted value.
range.maxNo (one bound required)The maximum accepted value. Must be greater than min.
range.isMinInclusiveNotrue (default) to accept values equal to min.
range.isMaxInclusiveNotrue (default) to accept values equal to max.

The following monitor checks each day of data, per value of my_group_field, and fails when more than 1% of the rows have a my_field value outside the range:

kind: ValueRange
field: my_field
range:
  min: 0
  isMinInclusive: false
  max: 10000
threshold:
  kind: Static
  valueMode: Percentage
  max: 1%
timeWindow:
  field: my_time_field
  firstRun: P365D
  frequency: P1D
groupBy:
  field: my_group_field

For the shared parameters (threshold, timeWindow, whereStatement, groupBy, partition), see the Parameters reference.


Did this page help you?