Nulls

Detects null, and optionally empty, values in a field.

The Nulls monitor counts the rows where a field is empty (null), and alerts you when there are too many.

When to Use

  • Mandatory fields: A mandatory field, such as a foreign key, must never be empty. Keep the default threshold to fail on the first null value.
  • Optional fields: Many users leave an optional field, such as a phone number, empty, but a sudden increase in its share of missing values reveals a broken form. Use the percentage value mode with a dynamic or relative threshold.
  • Empty strings: A source system writes '' instead of NULL in a string field. Count empty strings as null values.

How It Works

For each data point, Sifflet counts the rows where the field matches the Null values setting, and computes:

  • Count (default value mode): The number of null rows.
  • Percentage: The share of null 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.

The default static threshold fails when the data point is greater than 0, that is, as soon as one null value is found. Change the threshold to tolerate some null values, to compare with the previous data point (relative), or to learn the usual number of null values (dynamic).

Example

You want every order to have a customer. Create a Nulls monitor on orders with the following settings:

  • Column to monitor: customer_id.
  • 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 3, a bug in the checkout creates 12 orders without a customer_id. The data point of June 3 is 12, greater than 0, so the monitor fails.

Configure the Monitor

Nulls Settings

SettingDescriptionDefault
Column to monitorThe field to check.None
Null valuesWhat counts as a null value: Null, Null and Empty (also counts ''), or Null, Empty and Whitespaces (also counts strings made of spaces only). The last two options are only available for string fields.Null

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 FieldNulls. The following YAML creates the monitor of the example:

kind: FieldNulls
field: customer_id
timeWindow:
  field: created_at
  firstRun: P365D
  frequency: P1D
ParameterRequiredDescription
fieldYesThe field to check.
nullValuesNoNull (default), NullAndEmpty, or NullEmptyAndWhitespaces. The last two require a string field.

The following monitor checks all the rows of the table at each run and fails when more than 5% of the my_field values are null or empty:

kind: FieldNulls
field: my_field
nullValues: NullAndEmpty
threshold:
  kind: Static
  valueMode: Percentage
  max: 5%

For the shared parameters, see the Parameters reference.


Did this page help you?