diff options
author | Christopher Baines <mail@cbaines.net> | 2020-12-05 17:52:31 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-12-05 17:52:31 +0000 |
commit | 2549c482fb04db84481d595f0bf99a1c8bb97c4c (patch) | |
tree | 2c03497402c38d9b0cbf3c9eb2ccf54ed94409b9 | |
parent | 7868c838406635c546b388f8fa3b99b9597fd33f (diff) | |
download | prometheus-2549c482fb04db84481d595f0bf99a1c8bb97c4c.tar prometheus-2549c482fb04db84481d595f0bf99a1c8bb97c4c.tar.gz |
Fix issues with outputting values
Ensure numbers are formatted as floats.
-rw-r--r-- | prometheus.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/prometheus.scm b/prometheus.scm index 464b546..68a3fa2 100644 --- a/prometheus.scm +++ b/prometheus.scm @@ -22,6 +22,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:use-module (ice-9 threads) #:use-module (ice-9 exceptions) #:export (make-metrics-registry @@ -404,9 +405,9 @@ so that it can receive and store the metric values." (hash-for-each (lambda (label-values value) - (simple-format + (format port - "~A~A ~A\n" + "~a~a ~f\n" full-name (if (null? label-values) "" @@ -414,10 +415,15 @@ so that it can receive and store the metric values." "{" (string-join (map (match-lambda + ((label . (? number? value)) + (format + #f + "~a=\"~f\"" + label value)) ((label . value) - (simple-format + (format #f - "~A=\"~A\"" + "~a=\"~a\"" label value))) label-values) ",") |