X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fbeam_stats_msg_graphite.erl;h=b423e630e0ac4383cd8829a94e086a0b7733176a;hb=d07a494beb262bbae36ec2f65b496bcee3963a38;hp=1592549bd59f174e32fd192bb1282344ea097d5c;hpb=a9ed8751fd77abc47095007370136432f773213a;p=beam_stats.git diff --git a/src/beam_stats_msg_graphite.erl b/src/beam_stats_msg_graphite.erl index 1592549..b423e63 100644 --- a/src/beam_stats_msg_graphite.erl +++ b/src/beam_stats_msg_graphite.erl @@ -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 }, <> ) -> - 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()]. @@ -41,14 +56,19 @@ of_memory(Memory, <>, Timestamp) -> ComponentToMessage = fun ({Key, Value}) -> KeyBin = atom_to_binary(Key, latin1), - ?T - { path = [NodeID, <<"memory">>, KeyBin] - , value = Value - , timestamp = Timestamp - } + cons([NodeID, <<"memory">>, KeyBin], Value, 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) ->