Skip to main content
Reads time series from a TimeSeries table filtered by a selector and with timestamps in a specified interval. This function is similar to range selectors but it’s used to implement instant selectors too.

Syntax

Arguments

  • db_name - The name of the database where a TimeSeries table is located.
  • time_series_table - The name of a TimeSeries table.
  • instant_query - An instant selector written in PromQL syntax, without @ or offset modifiers.
  • min_time - Start timestamp, inclusive.
  • max_time - End timestamp, inclusive.
  • return_columns - The columns returning the samples: 'samples' or 'timestamp_and_value', see below.
min_time and max_time can have fractions of a second even if the timestamps in the table are whole seconds: the function selects the samples with min_time <= timestamp <= max_time exactly, without rounding the bounds to the type of the timestamps.

Returned value

The function returns the column id with the identifiers of the time series matching the specified selector, and the samples in the columns chosen by the argument return_columns:
  • 'samples' - the column samples with the samples of a time series as an array of tuples (timestamp, value) sorted by timestamp. The samples of a time series can be returned in multiple rows, for example one row per time bucket of the samples table. Use the aggregate function timeSeriesGroupArray to merge the rows of a time series.
  • 'timestamp_and_value' - the columns timestamp and value with one sample per row.
A TimeSeries table of version 11 or later stores buckets of samples as arrays, the tables of earlier versions store one sample per row. The samples are converted when the requested columns differ from the layout of the table, which costs some time; the PromQL functions request the columns matching the layout of the table. There is no specific order for returned data.

Examples