feat: handle scalar beam_stats values in graphite_msg
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 23 Sep 2015 13:52:32 +0000 (09:52 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 24 Sep 2015 01:50:31 +0000 (21:50 -0400)
src/beam_stats_msg_graphite.erl

index 1592549..8c13d60 100644 (file)
@@ -29,11 +29,26 @@ of_beam_stats(#beam_stats
     { timestamp = Timestamp
     , node_id   = _
     , memory    = Memory
-    % TODO: Handle the rest of data point
+    % TODO: Handle the rest of data points
+    , io_bytes_in      = IOBytesIn
+    , io_bytes_out     = IOBytesOut
+    , context_switches = ContextSwitches
+    , reductions       = Reductions
+    , run_queue        = RunQueue
+    , ets              = _ETS
+    , processes        = _Processes
     },
     <<NodeID/binary>>
 ) ->
-    of_memory(Memory, NodeID, Timestamp).
+    Ts = Timestamp,
+    N = NodeID,
+    [ cons([N, <<"io">>               , <<"bytes_in">> ], IOBytesIn      , Ts)
+    , cons([N, <<"io">>               , <<"bytes_out">>], IOBytesOut     , Ts)
+    , cons([N, <<"context_switches">>                  ], ContextSwitches, Ts)
+    , cons([N, <<"reductions">>                        ], Reductions     , Ts)
+    , cons([N, <<"run_queue">>                         ], RunQueue       , Ts)
+    | of_memory(Memory, NodeID, Ts)
+    ].
 
 -spec of_memory([{atom(), non_neg_integer()}], binary(), erlang:timestamp()) ->
     [t()].
@@ -49,6 +64,15 @@ of_memory(Memory, <<NodeID/binary>>, Timestamp) ->
         end,
     lists:map(ComponentToMessage, Memory).
 
+-spec cons([binary()], integer(), erlang:timestamp()) ->
+    t().
+cons(Path, Value, Timestamp) ->
+    ?T
+    { path      = Path
+    , value     = Value
+    , timestamp = Timestamp
+    }.
+
 -spec node_id_to_bin(node()) ->
     binary().
 node_id_to_bin(NodeID) ->
This page took 0.023464 seconds and 4 git commands to generate.