Allow passing more options to call-with-duration-metric

This commit is contained in:
Christopher Baines 2020-12-05 17:52:12 +00:00
parent 6d9f8c57eb
commit 7868c83840

View file

@ -341,7 +341,12 @@ values are the values."
0))))))
buckets)))))
(define (call-with-duration-metric registry metric-name thunk)
(define* (call-with-duration-metric registry metric-name thunk
#:key
(buckets %default-histogram-buckets)
docstring
(labels '())
(label-preset-values '()))
"Call @var{thunk} while recording the duration in seconds between
calling @var{thunk} and the procedure ending using a metric by the
name of @var{metric-name}.
@ -353,7 +358,11 @@ The metric with the name @var{metric-name} is fetched from the
(or (metrics-registry-fetch-metric registry metric-name)
(make-histogram-metric
registry
metric-name)))
metric-name
#:buckets buckets
#:docstring docstring
#:labels labels
#:label-preset-values label-preset-values)))
(start-time (current-time)))
(call-with-values
thunk