|
@@ -5,38 +5,16 @@ import _ from 'lodash';
|
|
|
class GrafanaDatasource {
|
|
class GrafanaDatasource {
|
|
|
|
|
|
|
|
/** @ngInject */
|
|
/** @ngInject */
|
|
|
- constructor(private backendSrv) {}
|
|
|
|
|
|
|
+ constructor(private backendSrv, private $q) {}
|
|
|
|
|
|
|
|
query(options) {
|
|
query(options) {
|
|
|
- return this.backendSrv.post('/api/tsdb/query', {
|
|
|
|
|
- from: options.range.from.valueOf().toString(),
|
|
|
|
|
- to: options.range.to.valueOf().toString(),
|
|
|
|
|
- queries: [
|
|
|
|
|
- {
|
|
|
|
|
- "refId": "A",
|
|
|
|
|
- "scenarioId": "random_walk",
|
|
|
|
|
- "intervalMs": options.intervalMs,
|
|
|
|
|
- "maxDataPoints": options.maxDataPoints,
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
-
|
|
|
|
|
- var data = [];
|
|
|
|
|
- if (res.results) {
|
|
|
|
|
- _.forEach(res.results, queryRes => {
|
|
|
|
|
- for (let series of queryRes.series) {
|
|
|
|
|
- data.push({
|
|
|
|
|
- target: series.name,
|
|
|
|
|
- datapoints: series.points
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return {data: data};
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return this.$q.when({data: []});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ metricFindQuery() {
|
|
|
|
|
+ return this.$q.when([]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
annotationQuery(options) {
|
|
annotationQuery(options) {
|
|
|
return this.backendSrv.get('/api/annotations', {
|
|
return this.backendSrv.get('/api/annotations', {
|
|
|
from: options.range.from.valueOf(),
|
|
from: options.range.from.valueOf(),
|