Skip to content

Commit

Permalink
in backends, call tick() before cleaning up
Browse files Browse the repository at this point in the history
this helps flushing signals that are being batched.

close #69
  • Loading branch information
c-cube committed Oct 16, 2024
1 parent 1924ff7 commit 276ba2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
6 changes: 5 additions & 1 deletion src/client-ocurl/opentelemetry_client_ocurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 276ba2e

Please sign in to comment.