Skip to content

Commit

Permalink
Metrics: trim open FDs output
Browse files Browse the repository at this point in the history
  • Loading branch information
zbaylin committed Dec 13, 2023
1 parent 9fbf572 commit 37a1a46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/metric.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ let get_free_memory file =
|> Lwt_result.catch

let get_open_fds () =
Util.run_cmd "ls -a /proc/self/fd/ | wc -l"
>|= int_of_string |> Lwt_result.catch
Lwt_result.Infix.(
Util.run_cmd "ls -a /proc/self/fd/ | wc -l"
|> Lwt_result.catch >|= String.trim
>>= fun i ->
try Lwt.return_ok (int_of_string i) with exn -> Lwt.return_error exn)

let process () =
let timestamp = Timestamp.now_ms () in
Expand Down

0 comments on commit 37a1a46

Please sign in to comment.