Skip to content

Commit 2ad48fe

Browse files
committed
Added optimization for number generation
1 parent 7a35326 commit 2ad48fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/prometheus/unparser.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,11 @@ function Unparser:unparseExpression(expression, tabbing)
423423
end
424424

425425
if(expression.kind == AstKind.NumberExpression) then
426-
return tostring(expression.value);
426+
local str = tostring(expression.value);
427+
if(str:sub(1, 2) == "0.") then
428+
str = str:sub(2);
429+
end
430+
return str;
427431
end
428432

429433
if(expression.kind == AstKind.VariableExpression or expression.kind == AstKind.AssignmentVariable) then

0 commit comments

Comments
 (0)