Telemetry - script API
Functions for accessing telemetry
This page describes StackState v4.4.x.
The StackState 4.4 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.4 version range to upgrade to a more recent release.
Function query
query
A telemetry query is a conjunction of equality conditions. E.g. name = 'system.load.norm.15' and host='localhost'
. There are several builder methods available that help to refine query time range, limit the number of points returned, or set a metric field.
As of yet, telemetry queries only support metric queries. If you need event queries, please enter a feature request at support.stackstate.com
Args:
dataSourceName
- name of the data source.query
- set of equality conditions.
Returns:
AsyncScriptResult[TelemetryScriptApiQueryResponse]
Builder methods:
aggregation(method: String, bucketSize: String)
- returns aggregated telemetry usingmethod
andbucketSize
. See the available aggregation methods.start(time: Instant)
- sets the start time of the query, for example-3h
.end(time: Instant)
- sets the end time of the query, for example-1h
.window(start: Instant, end: Instant)
- sets query time range. Use onlystart
to get all telemetry up to now or onlyend
to get all telemetry up to an instant in time.limit(points: Int)
- limits the number of points returned, applicable to none aggregated queries.metricField(fieldName: String)
- optional, but may be required for some data sources. Sets a field that holds metric value.compileQuery()
- returns the telemetry query that was created with this function and the builder methods. After this builder method no more builder methods can be called.
Examples:
Get raw metric by query
Get metric aggregated using Mean during with bucket size 1 minute:
Query metrics starting 3 hours ago till now:
Query metrics starting beginning of the data till last hour ago:
Query metrics within time range starting 3 hours ago up to 1 hour ago:
Query metrics from field "value" and limits points returned:
Aggregation methods
The following aggregation methods are available for use with telemetry:
MEAN
- meanPERCENTILE_25
- 25 percentilePERCENTILE_50
- 50 percentilePERCENTILE_75
- 75 percentilePERCENTILE_90
- 90 percentilePERCENTILE_95
- 95 percentilePERCENTILE_98
- 98 percentilePERCENTILE_99
- 99 percentileMAX
- maximumMIN
- minimumSUM
- sumEVENT_COUNT
- the number of occurrences during bucket intervalSUM_NO_ZEROS
- sum of the values (missing values from a data source won't be filled with zeros)EVENT_COUNT_NO_ZEROS
- the number of occurrences during bucket interval (missing values from a data source won't be filled with zeros)
Last updated