Function | Description | Example |
---|---|---|
fill() | Interpolate missing metric values for the metric. | <METRIC_NAME>{*}.fill(<METHOD>, <LIMIT>) |
The fill()
function has two parameters:
METHOD
: The function to use as an interpolation method; choose from:
LIMIT
[optional, default=300, maximum=600]: The interpolation limit (in seconds) that represents the maximum size of a gap you want to interpolate.
Function | Description | Example |
---|---|---|
default_zero() | Adds a default value to sparse metrics. | default_zero(system.load.1{*}) |
The default_zero()
function fills empty time intervals using the value 0 or, if interpolation is enabled, with interpolation. Note that interpolation is enabled by default for GAUGE
type metrics. Like most functions, default_zero()
is applied after time and space aggregation.
The default_zero()
function is intended to address the following use cases (though it may also work for other use cases):
COUNT
or RATE
type metrics queried as_count()
or as_rate()
are always aligned as 0, so using default_zero()
does not change how they are aligned; it only affects GAUGE
type metrics).avg(last_10m):avg:system.cpu.idle{*} < 10
because this monitor triggers (instead of resolving) when it evaluates to 0. Avoid using this function for error rate monitors with as_count()
queries (see this article for details).To demonstrate how the default_zero()
function works, consider this single point created for a custom metric using DogStatsD:
$ echo -n "custom_metric:1|g" | nc -4u -w0 127.0.0.1 8125
When this metric is queried over the past 30 minutes, there is a single timestamp, because only one of the query’s rollup intervals has a point:
avg:custom_metric{*}
+---------------------+---------------+
| Timestamp | custom_metric |
+---------------------+---------------+
| --------- | --------- |
| 2019-04-17 17:45:00 | 1 |
+---------------------+---------------+
The default_zero()
function interpolates this point five minutes forward in time (the default interpolation limit for gauges), then fills the remaining empty intervals with zeros:
default_zero(avg:custom_metric{*})
+---------------------+-----------------------------+
| Timestamp | default_zero(custom_metric) |
+---------------------+-----------------------------+
| --------- | --------- |
| 2019-04-17 17:30:00 | 0 |
| 2019-04-17 17:31:00 | 0 |
...
| 2019-04-17 17:44:00 | 0 |
| 2019-04-17 17:45:00 | 1 |
| 2019-04-17 17:46:00 | 1 |
| 2019-04-17 17:47:00 | 1 |
| 2019-04-17 17:48:00 | 1 |
| 2019-04-17 17:49:00 | 1 |
| 2019-04-17 17:50:00 | 1 |
| 2019-04-17 17:51:00 | 0 |
| 2019-04-17 17:52:00 | 0 |
...
+---------------------+-----------------------------+
Consult the other available functions:
On this Page