File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ func ParseBestEffort(s string) float64 {
237
237
if strings .HasPrefix (s , "+" ) {
238
238
s = s [1 :]
239
239
}
240
- if strings .EqualFold (s , "inf" ) {
240
+ // "infinity" is needed for OpenMetrics support.
241
+ // See https://github.com/OpenObservability/OpenMetrics/blob/master/OpenMetrics.md
242
+ if strings .EqualFold (s , "inf" ) || strings .EqualFold (s , "infinity" ) {
241
243
if minus {
242
244
return - inf
243
245
}
Original file line number Diff line number Diff line change @@ -308,6 +308,10 @@ func TestParseBestEffort(t *testing.T) {
308
308
f ("-Inf" , math .Inf (- 1 ))
309
309
f ("+iNf" , math .Inf (1 ))
310
310
f ("INF" , math .Inf (1 ))
311
+ f ("infinity" , math .Inf (1 ))
312
+ f ("-Infinity" , math .Inf (- 1 ))
313
+ f ("+iNfINIty" , math .Inf (1 ))
314
+ f ("INFINITY" , math .Inf (1 ))
311
315
f ("nan" , math .NaN ())
312
316
f ("-nan" , math .NaN ())
313
317
f ("naN" , math .NaN ())
You can’t perform that action at this time.
0 commit comments