From 2c1c67bfe8c8af8d685327a5c269ab21b9492f38 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 12 Apr 2022 13:50:50 -0400 Subject: [PATCH] fix: emit traces, too --- src/client/opentelemetry_client_ocurl.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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