From 1924ff788baf43b6f6783140a786bcaf701db62b Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 16 Oct 2024 13:28:47 -0400 Subject: [PATCH] in `remove_backend`, call tick() then cleanup() on it --- src/core/opentelemetry.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/opentelemetry.ml b/src/core/opentelemetry.ml index 1e250f2..87b99d0 100644 --- a/src/core/opentelemetry.ml +++ b/src/core/opentelemetry.ml @@ -175,7 +175,12 @@ module Collector = struct (** Remove current backend, if any. @since NEXT_RELEASE *) - let remove_backend () : unit = Atomic.set backend None + let remove_backend () : unit = + match Atomic.exchange backend None with + | None -> () + | Some (module B) -> + B.tick (); + B.cleanup () (** Is there a configured backend? *) let[@inline] has_backend () : bool = Atomic.get backend != None