|
|
@@ -150,6 +150,23 @@ export default class InfluxQuery {
|
|
|
return str + '"' + tag.key + '" ' + operator + ' ' + value;
|
|
|
}
|
|
|
|
|
|
+ getMeasurementAndPolicy() {
|
|
|
+ var policy = this.target.policy
|
|
|
+ var measurement = this.target.measurement;
|
|
|
+
|
|
|
+ if (!measurement.match('^/.*/')) {
|
|
|
+ measurement = '"' + measurement+ '"';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (policy !== 'default') {
|
|
|
+ policy = '"' + this.target.policy + '".';
|
|
|
+ } else {
|
|
|
+ policy = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ return policy + measurement;
|
|
|
+ }
|
|
|
+
|
|
|
render() {
|
|
|
var target = this.target;
|
|
|
|
|
|
@@ -177,12 +194,7 @@ export default class InfluxQuery {
|
|
|
query += selectText;
|
|
|
}
|
|
|
|
|
|
- var measurement = target.measurement;
|
|
|
- if (!measurement.match('^/.*/') && !measurement.match(/^merge\(.*\)/)) {
|
|
|
- measurement = '"' + measurement+ '"';
|
|
|
- }
|
|
|
-
|
|
|
- query += ' FROM ' + measurement + ' WHERE ';
|
|
|
+ query += ' FROM ' + this.getMeasurementAndPolicy() + ' WHERE ';
|
|
|
var conditions = _.map(target.tags, (tag, index) => {
|
|
|
return this.renderTagCondition(tag, index);
|
|
|
});
|