Built-In PromQL Variables
Represents the time range currently selected in the time navigation and it is used to adapt operations like calculating average for a selected time interval. In the Live mode, the value is constantly updated to reflect the new time range.
$__range but this variable will be replaced with an absolute value in seconds.
Represents a time interval and is automatically configured based on the time range. Use it within a PromQL query to apply the most appropriate sampling corresponding to the time range you have selected. Setting it, ensures that the most granular data is accessible for aggregation in long intervals of time. This in turn helps load panels quickly.
You currently have no control over the sampling visualized in a time chart. Sysdig determines the best and the maximum number of samples for aggregation from what’s currently available in the data store while maintaining good performance. Therefore
$__interval offers a way to avoid referencing an explicit, static sampling, such as 1 minute, and instead allow for runtime substitution with the sampling that is picked by the Sysdig.
$__interval but this variable will be replaced with an absolute value in seconds.
Time builtins summary
$__range are replaced with the time range you have selected, such as 10s, 1m, 10m, whereas
$_range_sec are replaced with seconds and can be used everywhere in the query.
In the example below, if
$_interval is 10m ,
$_interval_sec will be 600 .
$__range variables can be used in the range vector selector.
In normal cases, you cannot use the rate function to calculate the rate of gauge metrics. For example,
sysdig_host_cpu_used_percent is a gauge metric and you can’t use the rate function because rate should only be used with counters while
sysdig_host_cpu_used_percent is a gauge.
In such case, you can use
$_interval_sec to compute the rate as follows:
sum_over_time(sysdig_container_cpu_used_percent[$__interval]) / $__interval_sec
sum_over_time(sysdig_container_cpu_used_percent[$__range]) / $__range_sec
$__scope is only supported when a scope if defined (Currently only in Metrics Explorer and Dashboards)
Represents the selected scope that is applied to a PromQL query. The defined scope is applied by using the filter functionality of PromQL similar to how scope variables are applied. It allows you to apply whole Dashboard scope to the queries, instead of applying each scope variable individually. You can place this builtin anywhere within the query expression. Using multiple
$__scope variages in a single expression is not allowed.
See Using $__scope.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.