expose GC_metrics.get_runtime_attributes

This commit is contained in:
Matt Bray 2022-04-12 16:25:52 +01:00
parent bf4ac37f21
commit 66693280ec

View file

@ -711,17 +711,21 @@ module GC_metrics : sig
val basic_setup : unit -> unit val basic_setup : unit -> unit
(** Setup a hook that will emit GC statistics regularly *) (** Setup a hook that will emit GC statistics regularly *)
val get_runtime_attributes : unit -> Span.key_value list
(** Get OCaml name and version runtime attributes *)
val get_metrics : unit -> Metrics.t list val get_metrics : unit -> Metrics.t list
(** Get a few metrics from the current state of the GC *) (** Get a few metrics from the current state of the GC *)
end = struct end = struct
(** See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/process.md#process-runtimes *) (** See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/process.md#process-runtimes *)
let runtime_attributes : Proto.Common.key_value list = let runtime_attributes =
Conventions.Attributes.[ lazy
(Process.Runtime.name, "ocaml"); Conventions.Attributes.[
(Process.Runtime.version, Sys.ocaml_version); (Process.Runtime.name, `String "ocaml");
] (Process.Runtime.version, `String Sys.ocaml_version);
|> List.map (fun (key, value) -> ]
Proto.Common.default_key_value ~key ~value:(Some (String_value value)) ())
let get_runtime_attributes () = Lazy.force runtime_attributes
let basic_setup () = let basic_setup () =
let trigger() = let trigger() =