Skip to content

Variables

Template variables can query Commands and use other variables as parameters.

Advanced variable format options

The formatting of the variable interpolation depends on the data source. There are some situations where you might want to change the default formatting.

Variables

Supported Parameters

Variables will be replaced in the following parameters:

Parameter Description Command
Key Key name GET, XRANGE, etc.
Query CLI query Any
Field Hash Field HGET, HMGET
Filter Filter TS.MRANGE, TS.QUERYINDEX
Legend Frame's name TS.RANGE
Value Serie's name TS.RANGE

How to use SUNION for multi-select variable?

SUNION Example

LUA

The LUA script should work fine on a single shard deployment:

eval "return redis.call('sunion',${region:singlequote})" 0

Redis Gears

Another option is to utilize RedisGears module:

gb = GB('CommandReader')
gb.flatmap(lambda x:  execute('SUNION', *x[1].split(",")))
gb.register(trigger='SUNION')

To execute the trigger in Grafana:

RG.TRIGGER SUNION ${region:csv}