[v9.2.x] Google Cloud Monitoring: Set frame interval to draw null values (#57914)
This commit is contained in:
@@ -2,6 +2,9 @@ package cloudmonitoring
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/data"
|
||||
"github.com/grafana/grafana/pkg/tsdb/intervalv2"
|
||||
)
|
||||
|
||||
func reverse(s string) string {
|
||||
@@ -24,3 +27,21 @@ func containsLabel(labels []string, newLabel string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func addInterval(period string, field *data.Field) error {
|
||||
period = strings.TrimPrefix(period, "+")
|
||||
p, err := intervalv2.ParseIntervalStringToTimeDuration(period)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err == nil {
|
||||
if field.Config != nil {
|
||||
field.Config.Interval = float64(p.Milliseconds())
|
||||
} else {
|
||||
field.SetConfig(&data.FieldConfig{
|
||||
Interval: float64(p.Milliseconds()),
|
||||
})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user