mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
f427f90a45
commit
fb5ff6a70f
@ -107,6 +107,10 @@ func InsightsMetricsResultToFrame(mr MetricsResult, metric, agg string, dimensio
|
|||||||
rowCounter++
|
rowCounter++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(frame.Fields) == 1 { // No data, only a time column, no sort
|
||||||
|
return frame, nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := data.SortWideFrameFields(frame, dimensions...); err != nil {
|
if err := data.SortWideFrameFields(frame, dimensions...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,16 @@ func TestInsightsMetricsResultToFrame(t *testing.T) {
|
|||||||
return frame
|
return frame
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "empty response",
|
||||||
|
testFile: "applicationinsights/5-application-insights-empty-response.json",
|
||||||
|
metric: "value",
|
||||||
|
agg: "avg",
|
||||||
|
expectedFrame: func() *data.Frame {
|
||||||
|
frame := data.NewFrame("", data.NewField("StartTime", nil, []time.Time{}))
|
||||||
|
return frame
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "segmented series",
|
name: "segmented series",
|
||||||
testFile: "applicationinsights/4-application-insights-response-metrics-segmented.json",
|
testFile: "applicationinsights/4-application-insights-response-metrics-segmented.json",
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
{"value":{"start":"2020-07-21T11:55:15.000Z","end":"2020-07-21T11:56:15.000Z","interval":"PT1M","segments":[]}}
|
Loading…
Reference in New Issue
Block a user