13
13
use Prometheus \Storage \Redis ;
14
14
use ValueError ;
15
15
16
+ use const INF ;
17
+
16
18
class RenderTextFormatTest extends TestCase
17
19
{
18
20
public function testOutputMatchesExpectations (): void
@@ -37,6 +39,10 @@ private function buildSamples(): array
37
39
->inc (['bob ' , 'al\ice ' ]);
38
40
$ registry ->getOrRegisterGauge ($ namespace , 'gauge ' , 'gauge-help-text ' , ['label1 ' , 'label2 ' ])
39
41
->inc (["bo \nb " , 'ali\"ce ' ]);
42
+ $ registry ->getOrRegisterGauge ($ namespace , 'gauge2 ' , '' , ['label1 ' ])
43
+ ->set (INF , ["infinity " ]);
44
+ $ registry ->getOrRegisterGauge ($ namespace , 'gauge2 ' , '' , ['label1 ' ])
45
+ ->set (-INF , ["infinity-negative " ]);
40
46
$ registry ->getOrRegisterHistogram ($ namespace , 'histogram ' , 'histogram-help-text ' , ['label1 ' , 'label2 ' ], [0 , 10 , 100 ])
41
47
->observe (5 , ['bob ' , 'alice ' ]);
42
48
$ registry ->getOrRegisterSummary ($ namespace , 'summary ' , 'summary-help-text ' , ['label1 ' , 'label2 ' ], 60 , [0.1 , 0.5 , 0.9 ])
@@ -54,6 +60,10 @@ private function getExpectedOutput(): string
54
60
# HELP mynamespace_gauge gauge-help-text
55
61
# TYPE mynamespace_gauge gauge
56
62
mynamespace_gauge{label1="bo\\nb",label2="ali\\\\ \"ce"} 1
63
+ # HELP mynamespace_gauge2
64
+ # TYPE mynamespace_gauge2 gauge
65
+ mynamespace_gauge2{label1="infinity"} +Inf
66
+ mynamespace_gauge2{label1="infinity-negative"} -Inf
57
67
# HELP mynamespace_histogram histogram-help-text
58
68
# TYPE mynamespace_histogram histogram
59
69
mynamespace_histogram_bucket{label1="bob",label2="alice",le="0"} 0
0 commit comments