diff --git a/src/client/opentelemetry_client_ocurl.ml b/src/client/opentelemetry_client_ocurl.ml index 239b2695..06dfebc4 100644 --- a/src/client/opentelemetry_client_ocurl.ml +++ b/src/client/opentelemetry_client_ocurl.ml @@ -399,22 +399,24 @@ let mk_emitter ~(config:Config.t) () : (module EMITTER) = if force || (not force && E_metrics.is_big_enough ()) then ( let batch = ref [AList.pop_all gc_metrics] in E_metrics.pop_iter_all (fun l -> batch := l :: !batch); - if not (batch_is_empty !batch) then ( + let do_something = not (l_is_empty !batch) in + if do_something then ( send_metrics_http !batch; ); Atomic.set last_wakeup (Mtime_clock.now()); - true + do_something ) else false in let emit_traces ?(force=false) () : bool = if force || (not force && E_trace.is_big_enough ()) then ( let batch = ref [] in E_trace.pop_iter_all (fun l -> batch := l :: !batch); - if not (l_is_empty !batch) then ( + let do_something = not (l_is_empty !batch) in + if do_something then ( send_traces_http !batch; ); Atomic.set last_wakeup (Mtime_clock.now()); - true + do_something ) else false in