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 given criteria.

FETCH either accepts a list of 5 parameters or a map with the parameters. Those are defining the read access rights, the concerned Geo Time Series and the time window.

Access rights

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.

Concerned Geo Time Series

FETCH selects Geo Time Series according to:

  • The selectors parameter, which is a list of selector.
  • If selectors is not found, FETCH uses the selector parameter which is a single selector.
  • If selector is not found, FETCH uses both class and labels parameters.

Time window

FETCH begins from the newest value and stop when the oldest value is collected. Thus, end must be defined in your request and defines the newest included value in your time window. If end is anterior to your oldest value, the result will be empty (no Geo Time Series). The span of the time window ending at end is then defined according to:

  • The timespan parameter.
  • If timespan is not defined, FETCH collects a maximum of count point.
  • If count is not defined, FETCH determines timespan with start. If start is more recent than end, end and start are permuted internally. Be careful, this means end is included but start is excluded from the time window.

If you want to read only Geo Time Series 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)