Avoid race conditions in call-with-duration-metric
This commit is contained in:
parent
f661edf72d
commit
9d39235cc8
1 changed files with 12 additions and 7 deletions
|
|
@ -372,13 +372,18 @@ The metric with the name @var{metric-name} is fetched from the
|
||||||
"
|
"
|
||||||
(let* ((metric
|
(let* ((metric
|
||||||
(or (metrics-registry-fetch-metric registry metric-name)
|
(or (metrics-registry-fetch-metric registry metric-name)
|
||||||
(make-histogram-metric
|
(monitor
|
||||||
registry
|
;; Check once more in case another thread has created
|
||||||
metric-name
|
;; the metric while this thread was waiting for the
|
||||||
#:buckets buckets
|
;; mutex
|
||||||
#:docstring docstring
|
(or (metrics-registry-fetch-metric registry metric-name)
|
||||||
#:labels labels
|
(make-histogram-metric
|
||||||
#:label-preset-values label-preset-values)))
|
registry
|
||||||
|
metric-name
|
||||||
|
#:buckets buckets
|
||||||
|
#:docstring docstring
|
||||||
|
#:labels labels
|
||||||
|
#:label-preset-values label-preset-values)))))
|
||||||
(start-time (get-internal-real-time)))
|
(start-time (get-internal-real-time)))
|
||||||
(call-with-values
|
(call-with-values
|
||||||
thunk
|
thunk
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue