prometheusQuery Table Function
Evaluates a prometheus query using data from a TimeSeries table over a range of evaluation times.
Syntax
Arguments
db_name- The name of the database where a TimeSeries table is located.time_series_table- The name of a TimeSeries table.promql_query- A query written in PromQL syntax.start_time- The start time of the evaluation range.end_time- The end time of the evaluation range.step- The step used to iterate the evaluation time fromstart_timetoend_time(inclusively).
Returned value
The function can returns different columns depending on the result type of the query passed to parameter promql_query:
| Result Type | Result Columns | Example |
|---|---|---|
| vector | tags Array(Tuple(String, String)), timestamp TimestampType, value ValueType | prometheusQuery(mytable, 'up') |
| matrix | tags Array(Tuple(String, String)), time_series Array(Tuple(TimestampType, ValueType)) | prometheusQuery(mytable, 'up[1m]') |
| scalar | scalar ValueType | prometheusQuery(mytable, '1h30m') |
| string | string String | prometheusQuery(mytable, '"abc"') |