Commit 1d4cace8 by Torkel Ödegaard

fix(testdata): fixed query in default grafana data source

parent d1bedfc1
///<reference path="../../../headers/common.d.ts" /> ///<reference path="../../../headers/common.d.ts" />
import _ from 'lodash';
class GrafanaDatasource { class GrafanaDatasource {
/** @ngInject */ /** @ngInject */
constructor(private backendSrv) {} constructor(private backendSrv) {}
query(options) { query(options) {
return this.backendSrv.get('/api/metrics/test', { return this.backendSrv.post('/api/tsdb/query', {
from: options.range.from.valueOf(), from: options.range.from.valueOf().toString(),
to: options.range.to.valueOf(), to: options.range.to.valueOf().toString(),
scenario: 'random_walk', queries: [
interval: options.intervalMs, {
maxDataPoints: options.maxDataPoints "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};
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment