remove unused code of Cloud Monitoring distribution metrics type (#45702)

This commit is contained in:
Mitsuhiro Tanda 2022-02-22 19:24:52 +09:00 committed by GitHub
parent 8ce59cb8a2
commit 7acb203b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,11 +166,10 @@ func (timeSeriesFilter *cloudMonitoringTimeSeriesFilter) parseResponse(queryRes
if len(point.Value.DistributionValue.BucketCounts) == 0 {
continue
}
maxKey := 0
for i := 0; i < len(point.Value.DistributionValue.BucketCounts); i++ {
value, err := strconv.ParseFloat(point.Value.DistributionValue.BucketCounts[i], 64)
if err != nil {
continue
return err
}
if _, ok := buckets[i]; !ok {
// set lower bounds
@ -197,38 +196,9 @@ func (timeSeriesFilter *cloudMonitoringTimeSeriesFilter) parseResponse(queryRes
ExecutedQueryString: executedQueryString,
},
}
if maxKey < i {
maxKey = i
}
}
buckets[i].AppendRow(point.Interval.EndTime, value)
}
for i := 0; i < maxKey; i++ {
if _, ok := buckets[i]; !ok {
bucketBound := calcBucketBound(point.Value.DistributionValue.BucketOptions, i)
additionalLabels := data.Labels{"bucket": bucketBound}
timeField := data.NewField(data.TimeSeriesTimeFieldName, nil, []time.Time{})
valueField := data.NewField(data.TimeSeriesValueFieldName, nil, []float64{})
frameName := formatLegendKeys(series.Metric.Type, defaultMetricName, seriesLabels,
additionalLabels, timeSeriesFilter)
valueField.Name = frameName
valueField.Labels = seriesLabels
setDisplayNameAsFieldName(valueField)
buckets[i] = &data.Frame{
Name: frameName,
RefID: timeSeriesFilter.RefID,
Fields: []*data.Field{
timeField,
valueField,
},
Meta: &data.FrameMeta{
ExecutedQueryString: executedQueryString,
},
}
}
}
}
for i := 0; i < len(buckets); i++ {
buckets[i].Meta.Custom = customFrameMeta