1313use Prometheus \Storage \Redis ;
1414use ValueError ;
1515
16+ use const INF ;
17+
1618class RenderTextFormatTest extends TestCase
1719{
1820 public function testOutputMatchesExpectations (): void
@@ -37,6 +39,10 @@ private function buildSamples(): array
3739 ->inc (['bob ' , 'al\ice ' ]);
3840 $ registry ->getOrRegisterGauge ($ namespace , 'gauge ' , 'gauge-help-text ' , ['label1 ' , 'label2 ' ])
3941 ->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 " ]);
4046 $ registry ->getOrRegisterHistogram ($ namespace , 'histogram ' , 'histogram-help-text ' , ['label1 ' , 'label2 ' ], [0 , 10 , 100 ])
4147 ->observe (5 , ['bob ' , 'alice ' ]);
4248 $ registry ->getOrRegisterSummary ($ namespace , 'summary ' , 'summary-help-text ' , ['label1 ' , 'label2 ' ], 60 , [0.1 , 0.5 , 0.9 ])
@@ -54,6 +60,10 @@ private function getExpectedOutput(): string
5460# HELP mynamespace_gauge gauge-help-text
5561# TYPE mynamespace_gauge gauge
5662mynamespace_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
5767# HELP mynamespace_histogram histogram-help-text
5868# TYPE mynamespace_histogram histogram
5969mynamespace_histogram_bucket{label1="bob",label2="alice",le="0"} 0
0 commit comments