Update src/core/opentelemetry.ml

This commit is contained in:
Simon Cruanes 2025-09-02 15:08:22 -04:00 committed by GitHub
parent 54b62af1a2
commit fa610ed535
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1471,7 +1471,7 @@ module Metrics_callbacks = struct
let register f : unit = let register f : unit =
(* sets [registered_with_on_tick] to [true] atomically, iff it is currently (* sets [registered_with_on_tick] to [true] atomically, iff it is currently
[false]. *) [false]. *)
if Atomic.compare_and_set registered_with_on_tick false true then if not (Atomic.exchange registered_with_on_tick true) then
(* make sure we call [f] (and others) at each tick *) (* make sure we call [f] (and others) at each tick *)
Collector.on_tick (fun () -> Collector.on_tick (fun () ->
let m = List.map (fun f -> f ()) (AList.get cbs_) |> List.flatten in let m = List.map (fun f -> f ()) (AList.get cbs_) |> List.flatten in