mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
fix: format float to avoid overflow (#16083)
Signed-off-by: giulianopz <panzironi.giuliano@gmail.com>
This commit is contained in:
parent
3f0de72da7
commit
2ef8706c27
|
@ -232,7 +232,7 @@ func (node *SubqueryExpr) getSubqueryTimeSuffix() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *NumberLiteral) String() string {
|
func (node *NumberLiteral) String() string {
|
||||||
return fmt.Sprint(node.Val)
|
return strconv.FormatFloat(node.Val, 'f', -1, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *ParenExpr) String() string {
|
func (node *ParenExpr) String() string {
|
||||||
|
|
|
@ -164,6 +164,10 @@ func TestExprString(t *testing.T) {
|
||||||
in: "{``=\"0\"}",
|
in: "{``=\"0\"}",
|
||||||
out: `{""="0"}`,
|
out: `{""="0"}`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
in: "1048576",
|
||||||
|
out: "1048576",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
model.NameValidationScheme = model.UTF8Validation
|
model.NameValidationScheme = model.UTF8Validation
|
||||||
|
|
Loading…
Reference in a new issue