1212use Prometheus \Storage \InMemory ;
1313use Prometheus \Storage \Redis ;
1414use ValueError ;
15+ use const INF ;
1516
1617class RenderTextFormatTest extends TestCase
1718{
@@ -37,6 +38,10 @@ private function buildSamples(): array
3738 ->inc (['bob ' , 'al\ice ' ]);
3839 $ registry ->getOrRegisterGauge ($ namespace , 'gauge ' , 'gauge-help-text ' , ['label1 ' , 'label2 ' ])
3940 ->inc (["bo \nb " , 'ali\"ce ' ]);
41+ $ registry ->getOrRegisterGauge ($ namespace , 'gauge2 ' , '' , ['label1 ' ])
42+ ->set (INF , ["infinity " ]);
43+ $ registry ->getOrRegisterGauge ($ namespace , 'gauge2 ' , '' , ['label1 ' ])
44+ ->set (-INF , ["infinity-negative " ]);
4045 $ registry ->getOrRegisterHistogram ($ namespace , 'histogram ' , 'histogram-help-text ' , ['label1 ' , 'label2 ' ], [0 , 10 , 100 ])
4146 ->observe (5 , ['bob ' , 'alice ' ]);
4247 $ registry ->getOrRegisterSummary ($ namespace , 'summary ' , 'summary-help-text ' , ['label1 ' , 'label2 ' ], 60 , [0.1 , 0.5 , 0.9 ])
@@ -54,6 +59,10 @@ private function getExpectedOutput(): string
5459# HELP mynamespace_gauge gauge-help-text
5560# TYPE mynamespace_gauge gauge
5661mynamespace_gauge{label1="bo\\nb",label2="ali\\\\ \"ce"} 1
62+ # HELP mynamespace_gauge2
63+ # TYPE mynamespace_gauge2 gauge
64+ mynamespace_gauge2{label1="infinity"} +Inf
65+ mynamespace_gauge2{label1="infinity-negative"} -Inf
5766# HELP mynamespace_histogram histogram-help-text
5867# TYPE mynamespace_histogram histogram
5968mynamespace_histogram_bucket{label1="bob",label2="alice",le="0"} 0
0 commit comments