This repository was archived by the owner on Dec 27, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ Metric-level attributes are attributes of the metric object(s) in your `metrics`
9898* unit - Arbitrary string that can be used to designate a unit value; for example, "Mbps". (optional)
9999* series - Name of the InfluxDB series that each target belongs to. (mandatory for InfluxDB)
100100* transform - A function that takes the value and returns a transformed value. (optional)
101+ * where - A ` where ` clause to pass to InfluxDB. (optional for InfluxDB)
101102
102103## Deployment
103104
Original file line number Diff line number Diff line change @@ -276,7 +276,12 @@ TasseoInfluxDBDatasource.prototype = {
276276 urlForMetric : function ( metric , period ) {
277277 var self = this ;
278278
279- return this . url + '/series?time_precision=s&u=' + self . user + '&p=' + self . pass + '&q=select%20' + metric . target + '%20from%20' + metric . series + '%20where%20time%20%3E%20now()%20-%20' + period + 'm%3B' ;
279+ var query = 'select ' + metric . target + ' from ' + metric . series + ' where time > now() - 5m' ;
280+ if ( metric . where ) {
281+ query += ' and (' + metric . where + ')' ;
282+ }
283+
284+ return this . url + '/series?time_precision=s&u=' + self . user + '&p=' + self . pass + '&q=' + escape ( query )
280285 }
281286}
282287
You can’t perform that action at this time.
0 commit comments