@@ -266,10 +266,10 @@ func TestSendSumOfHistogramsWithLabels(t *testing.T) {
266266 mf .SendSumOfHistogramsWithLabels (out , desc , "test_metric" , "label_one" )
267267 })
268268 expected := []* dto.Metric {
269- {Label : makeLabels ("label_one" , "a" ), Histogram : & dto.Histogram {SampleCount : uint64p ( 4 ) , SampleSum : float64p ( 10 ), Bucket : []* dto.Bucket {
270- {UpperBound : float64p ( 1 ) , CumulativeCount : uint64p ( 1 )},
271- {UpperBound : float64p ( 2 ) , CumulativeCount : uint64p ( 2 )},
272- {UpperBound : float64p ( 3 ) , CumulativeCount : uint64p ( 3 )},
269+ {Label : makeLabels ("label_one" , "a" ), Histogram : & dto.Histogram {SampleCount : new ( uint64 ( 4 )) , SampleSum : new ( float64 ( 10 ) ), Bucket : []* dto.Bucket {
270+ {UpperBound : new ( float64 ( 1 )) , CumulativeCount : new ( uint64 ( 1 ) )},
271+ {UpperBound : new ( float64 ( 2 )) , CumulativeCount : new ( uint64 ( 2 ) )},
272+ {UpperBound : new ( float64 ( 3 )) , CumulativeCount : new ( uint64 ( 3 ) )},
273273 }}},
274274 }
275275 require .ElementsMatch (t , expected , actual )
@@ -281,15 +281,15 @@ func TestSendSumOfHistogramsWithLabels(t *testing.T) {
281281 mf .SendSumOfHistogramsWithLabels (out , desc , "test_metric" , "label_two" )
282282 })
283283 expected := []* dto.Metric {
284- {Label : makeLabels ("label_two" , "b" ), Histogram : & dto.Histogram {SampleCount : uint64p ( 2 ) , SampleSum : float64p ( 4 ), Bucket : []* dto.Bucket {
285- {UpperBound : float64p ( 1 ) , CumulativeCount : uint64p ( 1 )},
286- {UpperBound : float64p ( 2 ) , CumulativeCount : uint64p ( 1 )},
287- {UpperBound : float64p ( 3 ) , CumulativeCount : uint64p ( 2 )},
284+ {Label : makeLabels ("label_two" , "b" ), Histogram : & dto.Histogram {SampleCount : new ( uint64 ( 2 )) , SampleSum : new ( float64 ( 4 ) ), Bucket : []* dto.Bucket {
285+ {UpperBound : new ( float64 ( 1 )) , CumulativeCount : new ( uint64 ( 1 ) )},
286+ {UpperBound : new ( float64 ( 2 )) , CumulativeCount : new ( uint64 ( 1 ) )},
287+ {UpperBound : new ( float64 ( 3 )) , CumulativeCount : new ( uint64 ( 2 ) )},
288288 }}},
289- {Label : makeLabels ("label_two" , "c" ), Histogram : & dto.Histogram {SampleCount : uint64p ( 2 ) , SampleSum : float64p ( 6 ), Bucket : []* dto.Bucket {
290- {UpperBound : float64p ( 1 ) , CumulativeCount : uint64p ( 0 )},
291- {UpperBound : float64p ( 2 ) , CumulativeCount : uint64p ( 1 )},
292- {UpperBound : float64p ( 3 ) , CumulativeCount : uint64p ( 1 )},
289+ {Label : makeLabels ("label_two" , "c" ), Histogram : & dto.Histogram {SampleCount : new ( uint64 ( 2 )) , SampleSum : new ( float64 ( 6 ) ), Bucket : []* dto.Bucket {
290+ {UpperBound : new ( float64 ( 1 )) , CumulativeCount : new ( uint64 ( 0 ) )},
291+ {UpperBound : new ( float64 ( 2 )) , CumulativeCount : new ( uint64 ( 1 ) )},
292+ {UpperBound : new ( float64 ( 3 )) , CumulativeCount : new ( uint64 ( 1 ) )},
293293 }}},
294294 }
295295 require .ElementsMatch (t , expected , actual )
@@ -301,15 +301,15 @@ func TestSendSumOfHistogramsWithLabels(t *testing.T) {
301301 mf .SendSumOfHistogramsWithLabels (out , desc , "test_metric" , "label_one" , "label_two" )
302302 })
303303 expected := []* dto.Metric {
304- {Label : makeLabels ("label_one" , "a" , "label_two" , "b" ), Histogram : & dto.Histogram {SampleCount : uint64p ( 2 ) , SampleSum : float64p ( 4 ), Bucket : []* dto.Bucket {
305- {UpperBound : float64p ( 1 ) , CumulativeCount : uint64p ( 1 )},
306- {UpperBound : float64p ( 2 ) , CumulativeCount : uint64p ( 1 )},
307- {UpperBound : float64p ( 3 ) , CumulativeCount : uint64p ( 2 )},
304+ {Label : makeLabels ("label_one" , "a" , "label_two" , "b" ), Histogram : & dto.Histogram {SampleCount : new ( uint64 ( 2 )) , SampleSum : new ( float64 ( 4 ) ), Bucket : []* dto.Bucket {
305+ {UpperBound : new ( float64 ( 1 )) , CumulativeCount : new ( uint64 ( 1 ) )},
306+ {UpperBound : new ( float64 ( 2 )) , CumulativeCount : new ( uint64 ( 1 ) )},
307+ {UpperBound : new ( float64 ( 3 )) , CumulativeCount : new ( uint64 ( 2 ) )},
308308 }}},
309- {Label : makeLabels ("label_one" , "a" , "label_two" , "c" ), Histogram : & dto.Histogram {SampleCount : uint64p ( 2 ) , SampleSum : float64p ( 6 ), Bucket : []* dto.Bucket {
310- {UpperBound : float64p ( 1 ) , CumulativeCount : uint64p ( 0 )},
311- {UpperBound : float64p ( 2 ) , CumulativeCount : uint64p ( 1 )},
312- {UpperBound : float64p ( 3 ) , CumulativeCount : uint64p ( 1 )},
309+ {Label : makeLabels ("label_one" , "a" , "label_two" , "c" ), Histogram : & dto.Histogram {SampleCount : new ( uint64 ( 2 )) , SampleSum : new ( float64 ( 6 ) ), Bucket : []* dto.Bucket {
310+ {UpperBound : new ( float64 ( 1 )) , CumulativeCount : new ( uint64 ( 0 ) )},
311+ {UpperBound : new ( float64 ( 2 )) , CumulativeCount : new ( uint64 ( 1 ) )},
312+ {UpperBound : new ( float64 ( 3 )) , CumulativeCount : new ( uint64 ( 1 ) )},
313313 }}},
314314 }
315315 require .ElementsMatch (t , expected , actual )
@@ -407,8 +407,8 @@ func TestSendSumOfSummariesPerUser(t *testing.T) {
407407 {
408408 Label : makeLabels ("user" , "user-1" ),
409409 Summary : & dto.Summary {
410- SampleCount : uint64p ( 3 ),
411- SampleSum : float64p ( 150 ),
410+ SampleCount : new ( uint64 ( 3 ) ),
411+ SampleSum : new ( float64 ( 150 ) ),
412412 Quantile : []* dto.Quantile {
413413 {
414414 Quantile : new (.25 ),
@@ -428,8 +428,8 @@ func TestSendSumOfSummariesPerUser(t *testing.T) {
428428 {
429429 Label : makeLabels ("user" , "user-2" ),
430430 Summary : & dto.Summary {
431- SampleCount : uint64p ( 3 ),
432- SampleSum : float64p ( 151 ),
431+ SampleCount : new ( uint64 ( 3 ) ),
432+ SampleSum : new ( float64 ( 151 ) ),
433433 Quantile : []* dto.Quantile {
434434 {
435435 Quantile : new (.25 ),
@@ -1109,16 +1109,6 @@ func collectMetrics(t *testing.T, send func(out chan prometheus.Metric)) []*dto.
11091109 return metrics
11101110}
11111111
1112- //go:fix inline
1113- func float64p (v float64 ) * float64 {
1114- return new (v )
1115- }
1116-
1117- //go:fix inline
1118- func uint64p (v uint64 ) * uint64 {
1119- return new (v )
1120- }
1121-
11221112func BenchmarkGetLabels_SmallSet (b * testing.B ) {
11231113 m := prometheus .NewCounterVec (prometheus.CounterOpts {
11241114 Name : "test" ,
0 commit comments