FETCH


gts
Since v1.0.0
Available on all platforms
See also

Configuration parameters


The FETCH function interacts with the Warp 10 Storage Engine to retrieve data according to fetch criteria.

FETCH accepts a list of 5 paremeters, or a map with the parameter you want. Read below to find out parameter priority.

Fetch will select gts :

  • Fetch look at selectors parameter (list of selector)
  • If selectors are not found, fetch will use selector parameter (selector)
  • If selector is not found, fetch will use both class and labels parameters.

Fetch will collect data values in the past. FETCH always start from the end, and always stops when the oldest value is collected :

  • First step is to go to end. end must be defined in your request. If end is anterior to your first value, result will be empty (no GTS).
  • Second step si to collect data in the timespan window.
  • If timespan is not defined, FETCH collect a maximum of count point.
  • If count is not defined, FETCH define a timespan with start. If start is more recent than end, end and start are permuted internaly.

A valid read token is needed to read data with fetch. If you use a metaset and also specify a token, the token included in the metaset will be ignored.

If you want to read only GTS attributes or labels, using FIND is more efficient than fetching the last value.

Signature

Examples

//list parameter, fetch class ending with speed, with label id containing paris. //fetch from now the 1000 last values. [ $READTOKEN '~.*speed' { 'id' '~.*paris.*' } NOW -1000 ] FETCH 0 GET SIZE //take first GTS in the result list. size is 1000 //list parameter, fetch class ending with speed, with label id containing paris. //fetch values between two dates. (period is 100ms) [ $READTOKEN '~.*speed' { 'id' '~.*paris.*' } '2013-07-04T19:00:00Z' '2013-07-04T19:31:29Z' ] FETCH 0 GET SIZE //take first GTS in the result list. size is 14679 //list parameter, fetch class ending with speed, with label id containing paris. //fetch values 10 s before 2013-07-04 19h [ $READTOKEN '~.*speed' { 'id' '~.*paris.*' } [ 2013 07 04 19 ] TSELEMENTS-> 10 s ] FETCH 0 GET SIZE //take first GTS in the result list. size is 99 (period was not exactly 100ms)
// same examples, with a map parameter, { 'token' $READTOKEN 'class' '~.*speed' 'labels' { 'id' '~.*paris.*' } 'end' '2013-07-04T19:00:00Z' //look backward until this date 'count' 1000 //take 1000 points before this date } FETCH 0 GET SIZE //1000 values { 'token' $READTOKEN 'class' '~.*speed' 'labels' { 'id' '~.*paris.*' } 'end' '2013-07-04T19:00:00Z' //look backward until this date 'start' '2013-07-04T19:31:29Z' //no problem, end and start will be permuted internaly } FETCH 0 GET SIZE //14679 values { 'token' $READTOKEN 'class' '~.*speed' 'labels' { 'id' '~.*paris.*' } 'end' '2013-07-04T19:00:00Z' //look backward until this date 'timespan' 10 s //take 10 seconds of data before this date } FETCH 0 GET SIZE //99 values (period was not exactly 100ms)