@@ -528,11 +528,11 @@ func Test_FromMetrics(t *testing.T) {
528
528
expectedFromHistogram ("double_delta_histo" , labelMap , doubleHistDP , true ),
529
529
[]* datapoint.Datapoint {
530
530
int64SFxDataPoint ("double_histo_bad_counts_count" , datapoint .Counter , labelMap , int64 (doubleHistDP .Count )),
531
- doubleSFxDataPoint ("double_histo_bad_counts " , datapoint .Counter , labelMap , * doubleHistDP .Sum ),
531
+ doubleSFxDataPoint ("double_histo_bad_counts_sum " , datapoint .Counter , labelMap , * doubleHistDP .Sum ),
532
532
},
533
533
[]* datapoint.Datapoint {
534
534
int64SFxDataPoint ("int_histo_bad_counts_count" , datapoint .Counter , labelMap , int64 (intHistDP .Count )),
535
- doubleSFxDataPoint ("int_histo_bad_counts " , datapoint .Counter , labelMap , * intHistDP .Sum ),
535
+ doubleSFxDataPoint ("int_histo_bad_counts_sum " , datapoint .Counter , labelMap , * intHistDP .Sum ),
536
536
},
537
537
),
538
538
},
@@ -776,27 +776,29 @@ func expectedFromHistogram(
776
776
777
777
dps = append (dps ,
778
778
int64SFxDataPoint (metricName + "_count" , typ , dims , int64 (histDP .GetCount ())),
779
- doubleSFxDataPoint (metricName , typ , dims , histDP .GetSum ()))
779
+ doubleSFxDataPoint (metricName + "_sum" , typ , dims , histDP .GetSum ()))
780
780
781
781
explicitBounds := histDP .GetExplicitBounds ()
782
782
if explicitBounds == nil {
783
783
return dps
784
784
}
785
+ var le int64
785
786
for i := 0 ; i < len (explicitBounds ); i ++ {
786
787
dimsCopy := cloneStringMap (dims )
787
788
dimsCopy [upperBoundDimensionKey ] = float64ToDimValue (explicitBounds [i ])
788
- dps = append (dps , int64SFxDataPoint (metricName + "_bucket" , typ , dimsCopy , int64 (buckets [i ])))
789
+ le += int64 (buckets [i ])
790
+ dps = append (dps , int64SFxDataPoint (metricName + "_bucket" , typ , dimsCopy , le ))
789
791
}
790
792
dimsCopy := cloneStringMap (dims )
791
793
dimsCopy [upperBoundDimensionKey ] = float64ToDimValue (math .Inf (1 ))
792
- dps = append (dps , int64SFxDataPoint (metricName + "_bucket" , typ , dimsCopy , int64 (buckets [len (buckets )- 1 ])))
794
+ le += int64 (buckets [len (buckets )- 1 ])
795
+ dps = append (dps , int64SFxDataPoint (metricName + "_bucket" , typ , dimsCopy , le ))
793
796
return dps
794
797
}
795
798
796
799
func expectedFromSummary (name string , labelMap map [string ]string , count int64 , sumVal float64 ) []* datapoint.Datapoint {
797
- countName := name + "_count"
798
- countPt := int64SFxDataPoint (countName , datapoint .Counter , labelMap , count )
799
- sumPt := doubleSFxDataPoint (name , datapoint .Counter , labelMap , sumVal )
800
+ countPt := int64SFxDataPoint (name + "_count" , datapoint .Counter , labelMap , count )
801
+ sumPt := doubleSFxDataPoint (name + "_sum" , datapoint .Counter , labelMap , sumVal )
800
802
out := []* datapoint.Datapoint {countPt , sumPt }
801
803
quantileDimVals := []string {"0.25" , "0.5" , "0.75" , "1" }
802
804
for i := 0 ; i < 4 ; i ++ {
@@ -813,9 +815,8 @@ func expectedFromSummary(name string, labelMap map[string]string, count int64, s
813
815
}
814
816
815
817
func expectedFromEmptySummary (name string , labelMap map [string ]string , count int64 , sumVal float64 ) []* datapoint.Datapoint {
816
- countName := name + "_count"
817
- countPt := int64SFxDataPoint (countName , datapoint .Counter , labelMap , count )
818
- sumPt := doubleSFxDataPoint (name , datapoint .Counter , labelMap , sumVal )
818
+ countPt := int64SFxDataPoint (name + "_count" , datapoint .Counter , labelMap , count )
819
+ sumPt := doubleSFxDataPoint (name + "_sum" , datapoint .Counter , labelMap , sumVal )
819
820
return []* datapoint.Datapoint {countPt , sumPt }
820
821
}
821
822
0 commit comments