Commit 67ad9035 by Torkel Ödegaard

feat(test metrics): fixed issue with built in Grafana test data source, fixes #5299

parent 36b08027
......@@ -12,7 +12,7 @@ import (
"github.com/grafana/grafana/pkg/util"
)
func GetTestMetrics(c *middleware.Context) {
func GetTestMetrics(c *middleware.Context) Response {
from := c.QueryInt64("from")
to := c.QueryInt64("to")
maxDataPoints := c.QueryInt64("maxDataPoints")
......@@ -37,7 +37,7 @@ func GetTestMetrics(c *middleware.Context) {
result.Data[seriesIndex].DataPoints = points
}
c.JSON(200, &result)
return Json(200, &result)
}
func GetInternalMetrics(c *middleware.Context) Response {
......
......@@ -200,6 +200,11 @@ class MetricsPanelCtrl extends PanelCtrl {
this.panel.snapshotData = result.data;
}
if (!result || !result.data) {
console.log('Data source query result invalid, missing data field:', result);
result = {data: []};
}
return this.events.emit('data-received', result.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