@@ -19,6 +19,8 @@ prometheus_format_test_() ->
19
19
fun test_deregister /1 ,
20
20
fun test_remove /1 ,
21
21
fun test_default_value /1 ,
22
+ fun test_values_when_empty /1 ,
23
+ fun test_values_when_non_existing /1 ,
22
24
fun test_values /1 ,
23
25
fun test_collector1 /1 ,
24
26
fun test_collector2 /1 ,
@@ -85,6 +87,23 @@ test_errors(_) ->
85
87
{invalid_metric_help , 12 , " metric help is not a string" },
86
88
prometheus_quantile_summary :new ([{name , " qwe" }, {help , 12 }])
87
89
),
90
+ ? _assertError (
91
+ {invalid_bound , 3.141592 , " Bound should be a positive integer" },
92
+ prometheus_quantile_summary :new ([
93
+ {name , " qwe" },
94
+ {bound , 3.141592 },
95
+ {help , " " }
96
+ ])
97
+ ),
98
+ ? _assertError (
99
+ {invalid_error , 101 , " Error should be a percentage point in (0,100)" },
100
+ prometheus_quantile_summary :new ([
101
+ {name , " qwe" },
102
+ {error , 101 },
103
+ {labels , [" qua" , " quantile" ]},
104
+ {help , " " }
105
+ ])
106
+ ),
88
107
% % mf/arity errors
89
108
? _assertError (
90
109
{unknown_metric , default , unknown_metric },
@@ -400,6 +419,27 @@ test_default_value(_) ->
400
419
? _assertMatch ({0 , 0 , []}, SomethingValue )
401
420
].
402
421
422
+ test_values_when_empty (_ ) ->
423
+ prometheus_quantile_summary :new ([
424
+ {name , orders_summary },
425
+ {labels , [department ]},
426
+ {help , " Track orders count/total sum" }
427
+ ]),
428
+ [
429
+ ? _assertMatch (
430
+ [],
431
+ lists :sort (prometheus_quantile_summary :values (default , orders_summary ))
432
+ )
433
+ ].
434
+
435
+ test_values_when_non_existing (_ ) ->
436
+ [
437
+ ? _assertMatch (
438
+ [],
439
+ lists :sort (prometheus_quantile_summary :values (default , orders_summary ))
440
+ )
441
+ ].
442
+
403
443
test_values (_ ) ->
404
444
prometheus_quantile_summary :new ([
405
445
{name , orders_summary },
@@ -408,7 +448,6 @@ test_values(_) ->
408
448
]),
409
449
prometheus_quantile_summary :observe (orders_summary , [electronics ], 765.5 ),
410
450
prometheus_quantile_summary :observe (orders_summary , [groceries ], 112.3 ),
411
-
412
451
[
413
452
? _assertMatch (
414
453
[
0 commit comments