Skip to content

Commit

Permalink
Add cache stats to telemetry output
Browse files Browse the repository at this point in the history
  • Loading branch information
3Rafal committed Dec 5, 2023
1 parent 6e276fc commit ed8e7d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/frontend/ocamlmerlin/new/new_merlin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,16 @@ let run = function
let notify { Logger.section; msg } =
`String (Printf.sprintf "%s: %s" section msg)
in
let cache = Mpipeline.cache_information pipeline in
let format_cache (k,v) =
let fmt_str (k, v) = (k, `String v) in
(k, `Assoc (List.map fmt_str v)) in
let format_timing (k,v) = (k, `Int (int_of_float (0.5 +. v))) in
`Assoc [
"class", `String class_; "value", message;
"notifications", `List (List.rev_map notify !notifications);
"timing", `Assoc (List.map format_timing timing)
"timing", `Assoc (List.map format_timing timing);
"cache", `Assoc (List.map format_cache cache)
]
in
log ~title:"run(result)" "%a" Logger.json (fun () -> json);
Expand Down

0 comments on commit ed8e7d1

Please sign in to comment.