cloud monitor is returning floats and we are trying to parse as strings (#65407)

This commit is contained in:
Andrew Hackmann 2023-03-28 08:47:28 -05:00 committed by GitHub
parent c8252f9987
commit f0ddf900c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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:

View File

@ -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"`