Fix issues with outputting values

Ensure numbers are formatted as floats.
This commit is contained in:
Christopher Baines 2020-12-05 17:52:31 +00:00
parent 7868c83840
commit 2549c482fb

View file

@ -22,6 +22,7 @@
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-9) #:use-module (srfi srfi-9)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (ice-9 threads) #:use-module (ice-9 threads)
#:use-module (ice-9 exceptions) #:use-module (ice-9 exceptions)
#:export (make-metrics-registry #:export (make-metrics-registry
@ -404,9 +405,9 @@ so that it can receive and store the metric values."
(hash-for-each (hash-for-each
(lambda (label-values value) (lambda (label-values value)
(simple-format (format
port port
"~A~A ~A\n" "~a~a ~f\n"
full-name full-name
(if (null? label-values) (if (null? label-values)
"" ""
@ -414,10 +415,15 @@ so that it can receive and store the metric values."
"{" "{"
(string-join (map (string-join (map
(match-lambda (match-lambda
((label . value) ((label . (? number? value))
(simple-format (format
#f #f
"~A=\"~A\"" "~a=\"~f\""
label value))
((label . value)
(format
#f
"~a=\"~a\""
label value))) label value)))
label-values) label-values)
",") ",")