TS.MRANGE

Since 1.1.0Time series

Syntax

TS.MRANGE fromTimestamp toTimestamp [LATEST] [FILTER_BY_TS ts ...] [FILTER_BY_VALUE min max] [WITHLABELS | SELECTED_LABELS label ...] [COUNT count] [[ALIGN value] AGGREGATION agg[,agg ...] bucketDuration] [EXCLUDEEMPTY] FILTER <filters> [GROUPBY label REDUCE reducer]
  • ACL categories: @read, @slow, @timeseries
  • Arity: -1

Runs TS.RANGE over every time series whose labels match the FILTER, and returns each with its samples. It takes TS.RANGE's options, and also:

OptionEffect
WITHLABELSGive each series' labels.
SELECTED_LABELS label ...Give only these labels.
GROUPBY label REDUCE reducerMerge the series that share a value of label into one, with reducer (sum, min, max, avg, count and the others).
EXCLUDEEMPTYLeave out series with no samples in the range (Redis 8.10).

FILTER takes one or more label conditions:

ConditionMatches series where
l=vlabel l is v
l!=vlabel l is not v
l=label l is absent
l!=label l is present
l=(v1,v2)label l is one of these
l!=(v1,v2)label l is none of these

Reply

  • An array with, per series: its key, its labels (empty unless asked for), and its samples.

Examples

> TS.MRANGE - + AGGREGATION max 10000 FILTER kind=temp GROUPBY kind REDUCE max
1) 1) "kind=temp"
   2) (empty array)
   3) 1) 1) (integer) 0
         2) "24"