From f0ddf900c01a1bfb9eb509876107918daebfc0c7 Mon Sep 17 00:00:00 2001 From: Andrew Hackmann <5140848+bossinc@users.noreply.github.com> Date: Tue, 28 Mar 2023 08:47:28 -0500 Subject: [PATCH] cloud monitor is returning floats and we are trying to parse as strings (#65407) --- pkg/tsdb/cloudmonitoring/cloudmonitoring.go | 2 +- pkg/tsdb/cloudmonitoring/types.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/tsdb/cloudmonitoring/cloudmonitoring.go b/pkg/tsdb/cloudmonitoring/cloudmonitoring.go index dc411b8c729..1bc46bb5655 100644 --- a/pkg/tsdb/cloudmonitoring/cloudmonitoring.go +++ b/pkg/tsdb/cloudmonitoring/cloudmonitoring.go @@ -548,7 +548,7 @@ func calcBucketBound(bucketOptions cloudMonitoringBucketOptions, n int) string { switch { case bucketOptions.LinearBuckets != nil: - bucketBound = strconv.FormatInt(bucketOptions.LinearBuckets.Offset+(bucketOptions.LinearBuckets.Width*int64(n-1)), 10) + bucketBound = strconv.FormatFloat(bucketOptions.LinearBuckets.Offset+(bucketOptions.LinearBuckets.Width*float64(n-1)), 'f', 2, 64) case bucketOptions.ExponentialBuckets != nil: bucketBound = strconv.FormatInt(int64(bucketOptions.ExponentialBuckets.Scale*math.Pow(bucketOptions.ExponentialBuckets.GrowthFactor, float64(n-1))), 10) case bucketOptions.ExplicitBuckets != nil: diff --git a/pkg/tsdb/cloudmonitoring/types.go b/pkg/tsdb/cloudmonitoring/types.go index 118b2244682..d952b71da0e 100644 --- a/pkg/tsdb/cloudmonitoring/types.go +++ b/pkg/tsdb/cloudmonitoring/types.go @@ -107,9 +107,9 @@ type ( cloudMonitoringBucketOptions struct { LinearBuckets *struct { - NumFiniteBuckets int64 `json:"numFiniteBuckets"` - Width int64 `json:"width"` - Offset int64 `json:"offset"` + NumFiniteBuckets int64 `json:"numFiniteBuckets"` + Width float64 `json:"width"` + Offset float64 `json:"offset"` } `json:"linearBuckets"` ExponentialBuckets *struct { NumFiniteBuckets int64 `json:"numFiniteBuckets"`