Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/client-ocurl/opentelemetry_client_ocurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
c-cube marked this conversation as resolved.
Show resolved Hide resolved
if Batch.len batches.logs > 0 then send_logs ();
if Batch.len batches.traces > 0 then send_traces ()
) else (
Expand Down
5 changes: 5 additions & 0 deletions src/core/AList.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 2 additions & 0 deletions src/core/AList.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading