Skip to content

Commit

Permalink
CAD-2069 readProcStats/Linux: return less metrics for process stats
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Oct 16, 2020
1 parent 034962a commit 7a7b0b6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion iohk-monitoring/src/Cardano/BM/Counters/Linux.lhs
Expand Up @@ -395,7 +395,17 @@ readProcStats pid = do
let ticks = if length ps0 > 15 then (ps0 !! 13 + ps0 !! 14) else 0
let ps1 = zip colnames ps0
ps2 = [("cputicks",ticks)] <> filter (("unused" /=) . fst) ps1
return $ map (\(n,i) -> Counter StatInfo n (PureI i)) ps2
metricWanted = \case
0 -> True -- cputicks
20 -> True -- numthreads
24 -> True -- rss
42 -> True -- blkio
_ -> False
return $ catMaybes $ map (\((val,i), nr) ->
if metricWanted nr
then Just $ Counter StatInfo val (PureI i)
else Nothing) $
zip ps2 [0::Int ..]
where
colnames :: [Text]
colnames = [ "pid","unused","unused","ppid","pgrp","session","ttynr","tpgid","flags","minflt"
Expand Down

0 comments on commit 7a7b0b6

Please sign in to comment.