Functions

Overview

Functions are predefined procedures that perform a task or calculate a value.

They can be included by name in the condition and filter expressions as well as in placeholders.

  avg() > 80
  lower(tags.location) == 'nur'
  ${lower(tags.location)}

Function names are case-sensitive.

Functions are invoked when the expression is evaluated and replaced with the value returned by the function.

Arguments

The parameters passed to the function in brackets are called arguments.

Functions can accept arguments and return values in one of the following data types:

Notation Name Example
double double number percentile(99.5)
long long number elapsedTime(1515758392702)
integer integer number round(value, 1)
boolean boolean scriptOut('dsk.sh', [true])
string string startsWith(entity, 'NUR')
[] collection randomItem([1, 2, 3])
[string] collection of strings coalesce([tags.location, 'SVL'])
[k: v] key-value map randomKey(['john': 0.8, 'sam': 0.2])
object object rule_window('disk_check').status

Statistical

Univariate statistical functions listed below perform a calculation on the array of numeric values stored in the window.

Forecast

Forecast functions retrieve forecast values and variance from the database.

Value

Value` functions provide a way to retrieve values for other metrics contained in the same command.

Database Series

Series functions retrieve series values from the database whereas the series may be different from the series in the current window.

Database Message

Message functions retrieve message counts or specific messages from the database.

Database SQL

The functions return the results of user-defined SQL queries.

Mathematical

Math functions perform basic numeric operations on the input number and return a number as the result.

Text

Text functions transform and compare strings.

Formatting

These functions format dates and numbers to strings according to the specified pattern.

Table

Collection

Collection functions and operators check if the collection contains the specified element.

Lookup

Lookup functions retrieve records from replacement tables, collections, and other entities.

Distribution

Date

Date functions perform various operations on dates, timestamps and intervals.

Property

Property functions retrieve and compare property keys and tags.

Script

Execute the predefined script and return its output.

Rule

The rule functions provide a way to check the status of windows created by other rules.

Utility

Portal

Portal functions allow attaching custom portals to email and web notifications.

Web Query

Web Query functions allow to perform requests to external web services.

Security