fix: emit GC metrics even in the absence of custom metrics

This commit is contained in:
Simon Cruanes 2024-07-22 10:48:15 -04:00
parent f9233113b1
commit 592814dab8
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 10 additions and 1 deletions

View file

@ -348,7 +348,9 @@ end = struct
Queue.clear local_q;
if !must_flush_all then (
if Batch.len batches.metrics > 0 then send_metrics ();
if Batch.len batches.metrics > 0 || not (AList.is_empty gc_metrics)
then
send_metrics ();
if Batch.len batches.logs > 0 then send_logs ();
if Batch.len batches.traces > 0 then send_traces ()
) else (

View file

@ -4,6 +4,11 @@ type 'a t = 'a list Atomic.t
let make () = Atomic.make []
let[@inline] is_empty self : bool =
match Atomic.get self with
| [] -> true
| _ :: _ -> false
let get = Atomic.get
let add self x =

View file

@ -5,6 +5,8 @@ type 'a t
val get : 'a t -> 'a list
(** Snapshot *)
val is_empty : _ t -> bool
val make : unit -> 'a t
val add : 'a t -> 'a -> unit