---
title: Monitoring Sparse Metrics
description: >-
  Configure monitors for sparse or infrequent metrics using interpolation,
  evaluation delays, and appropriate settings to avoid unexpected results.
breadcrumbs: Docs > Monitors > Monitor Guides > Monitoring Sparse Metrics
---

# Monitoring Sparse Metrics

## Overview{% #overview %}

Monitors that report data infrequently, can have unexpected results and queries may not evaluate as intended. There are tools and behaviors that you can use to ensure a monitor's settings are appropriate for your data and expected evaluations.

This guide covers the following ways of troubleshooting and configuring monitors with sparse data:

- Determine if you have sparse metrics
- Consider the source of your monitor -> Metric-based monitor, Event-based monitor
- Is the monitor running on a schedule?

## How to determine whether you have a sparse metric{% #how-to-determine-whether-you-have-a-sparse-metric %}

You can use a dashboard widget, a notebook, or even an [existing monitor's history graph](https://docs.datadoghq.com/monitors/status/#investigate-a-monitor-in-a-notebook) and hover over the datapoints to see if the datapoints seem continuous, as opposed to straight lines filling the gaps between each point.

In a notebook, or widget, select the **Bars** display option to see the points of data and their frequency.

A metric displayed in a widget may look like this:

{% image
   source="https://datadog-docs.imgix.net/images/monitors/guide/sparse_metrics/line_graph_sparse.7defd507bcf7f5943028cebc58519e57.png?auto=format"
   alt="Metric graph with Line graph display going up and down in straight lines" /%}

But when the **Bars** style is applied, it looks like this:

{% image
   source="https://datadog-docs.imgix.net/images/monitors/guide/sparse_metrics/bar_graph_sparse.a96c47e82d7f610d279e8a0d1f0723b9.png?auto=format"
   alt="Same data as the Metric Line graph above, except with bars for each datapoint, highlighting gaps in between bars of sparse metrics" /%}

With the bar graph display, you can visualize the gaps between datapoints more clearly.

If the graph editor does not have multiple options to change the graph style, you can apply the function `default_zero()` to the metric, which helps reveal the gaps in data. For more information on this function, see the [Interpolation](https://docs.datadoghq.com/dashboards/functions/interpolation/#default-zero) documentation.

## Metric-based monitor{% #metric-based-monitor %}

Is this a [metric](https://docs.datadoghq.com/monitors/types/metric/?tab=threshold), [change](https://docs.datadoghq.com/monitors/types/metric/?tab=change), [anomaly](https://docs.datadoghq.com/monitors/types/anomaly/), [forecast](https://docs.datadoghq.com/monitors/types/forecasts/?tab=linear), or [outlier](https://docs.datadoghq.com/monitors/types/outlier/?tab=dbscan) monitor? Adjust the following settings:

- Under *Advanced options*, select **Do not require** a full window of data for evaluation.
- Is the data often delayed? Consider adding time (in seconds) to the monitor evaluation delay. Under *Advanced options* add a value to the **Delay monitor evaluation by X seconds** field.
- Adjust the evaluation (avg by, max by, min by, sum by) based on the expected frequency. The default evaluation is **avg by**, which may not be suited for sparse metrics.
- If you are using the **avg by** aggregator, consider adding an [interpolation function](https://docs.datadoghq.com/dashboards/functions/interpolation/#default-zero) like `default_zero()` to ensure the gaps in the metric are evaluated as zero.
- If you are using arithmetic in your query, take a look at [Monitor Arithmetic and Sparse Metrics](https://docs.datadoghq.com/monitors/guide/monitor-arithmetic-and-sparse-metrics) for some further guidance.

## Event-based monitor{% #event-based-monitor %}

Is this a [log](https://docs.datadoghq.com/monitors/types/log/), [event](https://docs.datadoghq.com/monitors/types/event/), [audit trail](https://docs.datadoghq.com/monitors/types/audit_trail/), or [error tracking](https://docs.datadoghq.com/monitors/types/error_tracking/?tab=count) monitor? Look at the following:

- Verify the "Missing data" setting corresponds to your expected monitor behavior: **Evaluate as zero**, **Show NO DATA**, **Show NO DATA and notify**, or **Show OK**
  {% image
     source="https://datadog-docs.imgix.net/images/monitors/guide/sparse_metrics/data_is_missing.0cd29b76e0d676c37226ca809c00fd4f.png?auto=format"
     alt="Selection options for missing data in the 'Set alert conditions' section of monitor configurations" /%}
- Adjust the evaluation period. If datapoints are expected to be available every 30 minutes, then the evaluation period should account for that.

## Schedule-based monitoring{% #schedule-based-monitoring %}

Are you monitoring an event that needs to happen at certain times of the day, week, month? A CRON task such as a backup job or export? Consider using [Custom Schedules](https://docs.datadoghq.com/monitors/guide/custom_schedules/?tab=day), which allow you to set RRULES to define when the monitor should evaluate and notify.

## Troubleshooting{% #troubleshooting %}

[Reach out to the Datadog support team](https://docs.datadoghq.com/help/) if you have any questions regarding monitoring sparse data.

## Further Reading{% #further-reading %}

- [Learn more about updating monitor settings through the API](https://docs.datadoghq.com/api/latest/monitors/#edit-a-monitor)
- [Learn more about interpolation](https://docs.datadoghq.com/dashboards/functions/interpolation/#default-zero)
