1 -module(beam_stats_msg_graphite).
3 -include("include/beam_stats.hrl").
4 -include("include/beam_stats_msg_graphite.hrl").
20 -spec of_beam_stats(beam_stats:t()) ->
22 of_beam_stats(#beam_stats{node_id=NodeID}=BeamStats) ->
23 NodeIDBin = node_id_to_bin(NodeID),
24 of_beam_stats(BeamStats, NodeIDBin).
26 -spec of_beam_stats(beam_stats:t(), binary()) ->
28 of_beam_stats(#beam_stats
29 { timestamp = Timestamp
32 % TODO: Handle the rest of data point
36 of_memory(Memory, NodeID, Timestamp).
38 -spec of_memory([{atom(), non_neg_integer()}], binary(), erlang:timestamp()) ->
40 of_memory(Memory, <<NodeID/binary>>, Timestamp) ->
43 KeyBin = atom_to_binary(Key, latin1),
45 { path = [NodeID, <<"memory">>, KeyBin]
47 , timestamp = Timestamp
50 lists:map(ComponentToMessage, Memory).
52 -spec node_id_to_bin(node()) ->
54 node_id_to_bin(NodeID) ->
55 NodeIDBin = atom_to_binary(NodeID, utf8),
56 re:replace(NodeIDBin, "[\@\.]", "_", [global, {return, binary}]).