@@ -322,9 +322,9 @@ func TestSendSumOfHistogramsWithLabels(t *testing.T) {
322322 }
323323}
324324
325- // TestSendSumOfCountersPerUserWithLabels tests to ensure multiple metrics for the same user with a matching label are
325+ // TestSendSumOfCountersPerUser_WithLabels tests to ensure multiple metrics for the same user with a matching label are
326326// summed correctly
327- func TestSendSumOfCountersPerUserWithLabels (t * testing.T ) {
327+ func TestSendSumOfCountersPerUser_WithLabels (t * testing.T ) {
328328 user1Metric := prometheus .NewCounterVec (prometheus.CounterOpts {Name : "test_metric" }, []string {"label_one" , "label_two" })
329329 user2Metric := prometheus .NewCounterVec (prometheus.CounterOpts {Name : "test_metric" }, []string {"label_one" , "label_two" })
330330 user3Metric := prometheus .NewCounterVec (prometheus.CounterOpts {Name : "test_metric" }, []string {"label_one" , "label_two" })
@@ -351,7 +351,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
351351 t .Run ("group metrics by user and label_one" , func (t * testing.T ) {
352352 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_one" }, nil )
353353 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
354- mf .SendSumOfCountersPerUserWithLabels (out , desc , "test_metric" , "label_one" )
354+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_one" ) )
355355 })
356356 expected := []* dto.Metric {
357357 {Label : makeLabels ("label_one" , "a" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (180 )}},
@@ -364,7 +364,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
364364 t .Run ("group metrics by user and label_one, and skip zero value metrics" , func (t * testing.T ) {
365365 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_one" }, nil )
366366 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
367- mf .SendSumOfCountersPerUserWithLabelsAndOptions (out , desc , "test_metric" , [] string { "label_one" }, SkipZeroValueMetrics )
367+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_one" ), WithSkipZeroValueMetrics )
368368 })
369369 expected := []* dto.Metric {
370370 {Label : makeLabels ("label_one" , "a" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (180 )}},
@@ -376,7 +376,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
376376 t .Run ("group metrics by user and label_two" , func (t * testing.T ) {
377377 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_two" }, nil )
378378 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
379- mf .SendSumOfCountersPerUserWithLabels (out , desc , "test_metric" , "label_two" )
379+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_two" ) )
380380 })
381381 expected := []* dto.Metric {
382382 {Label : makeLabels ("label_two" , "b" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (100 )}},
@@ -392,7 +392,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
392392 t .Run ("group metrics by user and label_two, and skip zero value metrics" , func (t * testing.T ) {
393393 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_two" }, nil )
394394 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
395- mf .SendSumOfCountersPerUserWithLabelsAndOptions (out , desc , "test_metric" , [] string { "label_two" }, SkipZeroValueMetrics )
395+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_two" ), WithSkipZeroValueMetrics )
396396 })
397397 expected := []* dto.Metric {
398398 {Label : makeLabels ("label_two" , "b" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (100 )}},
@@ -405,7 +405,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
405405 t .Run ("group metrics by user, label_one and label_two" , func (t * testing.T ) {
406406 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_one" , "label_two" }, nil )
407407 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
408- mf .SendSumOfCountersPerUserWithLabels (out , desc , "test_metric" , "label_one" , "label_two" )
408+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_one" , "label_two" ) )
409409 })
410410 expected := []* dto.Metric {
411411 {Label : makeLabels ("label_one" , "a" , "label_two" , "b" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (100 )}},
@@ -421,7 +421,7 @@ func TestSendSumOfCountersPerUserWithLabels(t *testing.T) {
421421 t .Run ("group metrics by user, label_one and label_two, and skip zero value metrics" , func (t * testing.T ) {
422422 desc := prometheus .NewDesc ("test_metric" , "" , []string {"user" , "label_one" , "label_two" }, nil )
423423 actual := collectMetrics (t , func (out chan prometheus.Metric ) {
424- mf .SendSumOfCountersPerUserWithLabelsAndOptions (out , desc , "test_metric" , [] string { "label_one" , "label_two" }, SkipZeroValueMetrics )
424+ mf .SendSumOfCountersPerUser (out , desc , "test_metric" , WithLabels ( "label_one" , "label_two" ), WithSkipZeroValueMetrics )
425425 })
426426 expected := []* dto.Metric {
427427 {Label : makeLabels ("label_one" , "a" , "label_two" , "b" , "user" , "user-1" ), Counter : & dto.Counter {Value : proto .Float64 (100 )}},
0 commit comments