@@ -85,7 +85,8 @@ testthat::test_that("Metrics with labels work as expected", {
85
85
testthat :: expect_equal(length(collect_metrics(reg )), 0 )
86
86
87
87
counter <- counter_metric(
88
- " count" , " Custom counter." , method = " GET" , endpoint = " /" , registry = reg
88
+ " count" , " Custom counter." , labels = c(" method" , " endpoint" ),
89
+ registry = reg
89
90
)
90
91
testthat :: expect_equal(counter $ inc(5 , method = " GET" , endpoint = " /" ), 5 )
91
92
testthat :: expect_equal(
@@ -94,7 +95,7 @@ testthat::test_that("Metrics with labels work as expected", {
94
95
testthat :: expect_equal(counter $ inc(method = " POST" , endpoint = " /" ), 1 )
95
96
96
97
gauge <- gauge_metric(
97
- " value" , " Custom gauge." , method = " GET " , endpoint = " / " , registry = reg
98
+ " value" , " Custom gauge." , labels = c( " method " , " endpoint" ) , registry = reg
98
99
)
99
100
testthat :: expect_equal(gauge $ set(5 , method = " GET" , endpoint = " /" ), 5 )
100
101
testthat :: expect_equal(
@@ -103,7 +104,8 @@ testthat::test_that("Metrics with labels work as expected", {
103
104
testthat :: expect_equal(gauge $ inc(method = " POST" , endpoint = " /" ), 1 )
104
105
105
106
hist <- histogram_metric(
106
- " dist" , " Custom histogram." , method = " GET" , endpoint = " /" , registry = reg
107
+ " dist" , " Custom histogram." , labels = c(" method" , " endpoint" ),
108
+ registry = reg
107
109
)
108
110
testthat :: expect_equal(
109
111
hist $ observe(51.7 , method = " GET" , endpoint = " /" ), 51.7
@@ -214,7 +216,8 @@ testthat::test_that("Histogram metrics render correctly in legacy format", {
214
216
reg <- registry()
215
217
216
218
hist <- histogram_metric(
217
- " dist" , " Custom histogram." , method = " GET" , endpoint = " /" , registry = reg
219
+ " dist" , " Custom histogram." , labels = c(" method" , " endpoint" ),
220
+ registry = reg
218
221
)
219
222
hist $ observe(51.7 , method = " GET" , endpoint = " /" )
220
223
hist $ observe(10 , method = " GET" , endpoint = " /" ,ignored = " value" )
0 commit comments