fill(set[], options={})

Given a sparse metric stream, fill() will “fill in” any missing data points with a value that you provide. The options map accepts the following:

  • value - A required parameter that must be a number or the special string last, which will repeat the last seen measurement value for the stream.
fill(s("AWS.ELB.HTTPCode_Backend_5XX", {"name": "prod.web*"}, {period: "60"}), {value: "0"})

In order for fill() to work, the metric must have its period attribute set, or you must supply period to the series function.

Example 1:

In the graph below, the metric has many streams which report intermittently:

composite-metric-no-fill

Let’s use the fill() function to ensure a 0 value is rendered every 5 minutes (300 seconds) if no data is received:

fill(s("json.errors.count", {"host": "prod.web*"}, {period: "300"}), {value: "0"})

All streams now display a 0 value if no measurements are received.

composite-metric-fill

Example 2:

In the graph below, the metric has many streams which report intermittently:

composite-last-fill-gaps

Here is the same graph with fill() applied to the metric, and setting the option value to last.

fill(s("json.errors.count", {"host": "prod.web*"}, {period: "300"}), {value: "last"})

composite-last-fill

The last recorded value within the viewable graph is repeated for the remaining intervals. This function is not recommended to be used with alerts as the last value only applies to the viewable graph, and will not pull the last value of historical data.