From 276ba2efd1cd54d84bff96ee180c203095352db4 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 16 Oct 2024 13:26:57 -0400 Subject: [PATCH] in backends, call tick() before cleaning up this helps flushing signals that are being batched. close #69 --- src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml | 6 +++++- src/client-ocurl/opentelemetry_client_ocurl.ml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml b/src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml index 05b1bab9..48ad9c84 100644 --- a/src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml +++ b/src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml @@ -569,7 +569,11 @@ let setup_ ?stop ?config () = let backend = create_backend ?stop ?config () in let (module B : OT.Collector.BACKEND) = backend in OT.Collector.set_backend backend; - B.cleanup + let cleanup () = + B.tick (); + B.cleanup () + in + cleanup let setup ?stop ?config ?(enable = true) () = if enable then ( diff --git a/src/client-ocurl/opentelemetry_client_ocurl.ml b/src/client-ocurl/opentelemetry_client_ocurl.ml index 0cb32a38..8d3ea113 100644 --- a/src/client-ocurl/opentelemetry_client_ocurl.ml +++ b/src/client-ocurl/opentelemetry_client_ocurl.ml @@ -509,7 +509,11 @@ let setup_ ?(stop = Atomic.make false) ?(config : Config.t = Config.make ()) () ignore (setup_ticker_thread ~stop ~sleep_ms backend () : Thread.t) ); - B.cleanup + let cleanup () = + B.tick (); + B.cleanup () + in + cleanup let setup ?stop ?config ?(enable = true) () = if enable then (