prometheusQuery 表函数
使用来自时间序列表的数据,在评估时间范围内评估 prometheus 查询。
语法
参数
db_name- 包含时间序列表的数据库名称。time_series_table- 一张时间序列表的名称。promql_query- 使用 PromQL 语法 编写的查询。start_time- 评估范围的起始时间。end_time- 评估范围的结束时间。step- 从start_time到end_time(包括)迭代评估时间所使用的步长。
返回值
该函数可以根据传递给参数 promql_query 的查询结果类型返回不同的列:
| 结果类型 | 结果列 | 示例 |
|---|---|---|
| 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"') |