メインコンテンツまでスキップ
メインコンテンツまでスキップ

prometheusQuery テーブル関数

TimeSeries テーブルからのデータを使用して、prometheus クエリを評価します。

構文

prometheusQuery('db_name', 'time_series_table', 'promql_query', evaluation_time)
prometheusQuery(db_name.time_series_table, 'promql_query', evaluation_time)
prometheusQuery('time_series_table', 'promql_query', evaluation_time)

引数

  • db_name - TimeSeries テーブルが存在するデータベースの名前。
  • time_series_table - TimeSeries テーブルの名前。
  • promql_query - PromQL 構文で書かれたクエリ。
  • evaluation_time - 評価のタイムスタンプ。現在の時刻でクエリを評価するには、evaluation_timeとして now() を使用します。

戻り値

この関数は、promql_queryパラメーターに渡されたクエリの結果タイプに応じて異なるカラムを返すことができます:

結果タイプ結果カラム
vectortags Array(Tuple(String, String)), timestamp TimestampType, value ValueTypeprometheusQuery(mytable, 'up')
matrixtags Array(Tuple(String, String)), time_series Array(Tuple(TimestampType, ValueType))prometheusQuery(mytable, 'up[1m]')
scalarscalar ValueTypeprometheusQuery(mytable, '1h30m')
stringstring StringprometheusQuery(mytable, '"abc"')

SELECT * FROM prometheusQuery(mytable, 'rate(http_requests{job="prometheus"}[10m])[1h:10m]', now())