mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudMonitoring: Remove link setting for SLO queries (#53031)
This commit is contained in:
parent
58ff0f07b4
commit
314eb5223f
@ -658,12 +658,14 @@ func addConfigData(frames data.Frames, dl string, unit string) data.Frames {
|
||||
if frames[i].Fields[1].Config == nil {
|
||||
frames[i].Fields[1].Config = &data.FieldConfig{}
|
||||
}
|
||||
deepLink := data.DataLink{
|
||||
Title: "View in Metrics Explorer",
|
||||
TargetBlank: true,
|
||||
URL: dl,
|
||||
if len(dl) > 0 {
|
||||
deepLink := data.DataLink{
|
||||
Title: "View in Metrics Explorer",
|
||||
TargetBlank: true,
|
||||
URL: dl,
|
||||
}
|
||||
frames[i].Fields[1].Config.Links = append(frames[i].Fields[1].Config.Links, deepLink)
|
||||
}
|
||||
frames[i].Fields[1].Config.Links = append(frames[i].Fields[1].Config.Links, deepLink)
|
||||
if len(unit) > 0 {
|
||||
if val, ok := cloudMonitoringUnitMappings[unit]; ok {
|
||||
frames[i].Fields[1].Config.Unit = val
|
||||
|
@ -459,6 +459,19 @@ func TestTimeSeriesFilter(t *testing.T) {
|
||||
}, *res.Frames[0].Meta)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("when data comes from a slo query, it should skip the link", func(t *testing.T) {
|
||||
data, err := loadTestFile("./test-data/3-series-response-distribution-exponential.json")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(data.TimeSeries))
|
||||
|
||||
res := &backend.DataResponse{}
|
||||
query := &cloudMonitoringTimeSeriesFilter{Params: url.Values{}, Slo: "yes"}
|
||||
err = query.parseResponse(res, data, "")
|
||||
require.NoError(t, err)
|
||||
frames := res.Frames
|
||||
assert.Equal(t, len(frames[0].Fields[1].Config.Links), 0)
|
||||
})
|
||||
}
|
||||
|
||||
func loadTestFile(path string) (cloudMonitoringResponse, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user