Summary
startsWith(metric|source|<pointTagKey>, "<string>", <tsExpression>)
endsWith(metric|source|<pointTagKey>, "<string>", <tsExpression>)
The startsWith()
function returns true if the specified metadata string starts with the given string, and returns false otherwise.
The endsWith()
function returns true if the specified metadata string ends with the given string, and returns false otherwise.
Parameters
Parameter | Description |
---|---|
metric|source|<pointTagKey> | The metadata string (metric name, source name, or value of a point tag key) to test for the specified starting or ending string. |
string | The starting or ending string to be tested for. |
tsExpression | The expression that describes the time series with the metadata string to be tested. |
Description
The startsWith()
and endsWith()
functions allow you to check whether a metadata string starts with or ends with a specified string. For example, you could check whether a host name starts with aws
or ends with 2020
.
The returned values (true
or false
) are displayed as metadata values in the chart legend or in a table column.
Example
In the example below, we check whether the string that’s the value of the service
point tag starts with data
or starts with ingester
. In the hover text, we can see that the result is true
for the first query and false
for the second.