{application, beam_stats,
[
{description, "Periodic VM stats production and consumption."},
- {vsn, "0.0.1"},
+ {vsn, "0.1.0"},
{registered, []},
{applications,
[ kernel
) ->
<<TimestampBin/binary>> = timestamp_to_bin(Timestamp),
<<NodeIDBin/binary>> = node_id_to_bin(NodeID),
- PairToBin = make_pair_to_bin(NodeIDBin, TimestampBin),
+ MemoryPairToBin = make_pair_to_bin(NodeIDBin, TimestampBin, <<"memory">>),
MemoryBinPairs = lists:map(fun atom_int_to_bin_bin/1, Memory),
- MemoryBins = lists:map(PairToBin, MemoryBinPairs),
+ MemoryBins = lists:map(MemoryPairToBin, MemoryBinPairs),
AllBins =
[ MemoryBins
],
TotalMicroSeconds = (TotalWholeSeconds * OneMillion) + ComponentMicro,
TotalMicroSeconds / OneMillion.
--spec make_pair_to_bin(binary(), binary()) ->
+-spec make_pair_to_bin(binary(), binary(), binary()) ->
fun(({binary(), binary()}) -> binary()).
-make_pair_to_bin(<<NodeID/binary>>, <<TimestampBin/binary>>) ->
+make_pair_to_bin(<<NodeID/binary>>, <<TimestampBin/binary>>, <<Type/binary>>) ->
fun ({<<K/binary>>, <<V/binary>>}) ->
<< TimestampBin/binary
, "|"
, NodeID/binary
, "|"
+ , Type/binary
+ , "|"
, K/binary
, "|"
, V/binary
TimestampInt = timestamp_to_integer(Timestamp),
TimestampBin = integer_to_binary(TimestampInt),
<<NodeIDBin/binary>> = node_id_to_bin(NodeID),
- PairToBin = make_pair_to_bin(NodeIDBin, TimestampBin),
+ MemoryPairToBin = make_pair_to_bin(NodeIDBin, TimestampBin, <<"memory">>),
MemoryBinPairs = lists:map(fun atom_int_to_bin_bin/1, Memory),
- MemoryBins = lists:map(PairToBin, MemoryBinPairs),
+ MemoryBins = lists:map(MemoryPairToBin, MemoryBinPairs),
AllBins =
[ MemoryBins
],
timestamp_to_integer({Megaseconds, Seconds, _}) ->
Megaseconds * 1000000 + Seconds.
--spec make_pair_to_bin(binary(), binary()) ->
+-spec make_pair_to_bin(binary(), binary(), binary()) ->
fun(({binary(), binary()}) -> binary()).
-make_pair_to_bin(<<NodeID/binary>>, <<TimestampBin/binary>>) ->
+make_pair_to_bin(<<NodeID/binary>>, <<TimestampBin/binary>>, <<Type/binary>>) ->
fun ({<<K/binary>>, <<V/binary>>}) ->
<< ?GRAPHITE_PATH_PREFIX
, "."
, NodeID/binary
, "."
+ , Type/binary
+ , "."
, K/binary
, " "
, V/binary
-spec memory_component_to_statsd_msg({atom(), non_neg_integer()}) ->
statsd_msg().
memory_component_to_statsd_msg({MemType, MemSize}) when MemSize >= 0 ->
+ MemTypeBin = atom_to_binary(MemType, latin1),
#statsd_msg
- { name = atom_to_binary(MemType, latin1)
+ { name = <<"memory.", MemTypeBin/binary>>
, value = MemSize
, type = gauge
}.
ResultOfReceive = gen_udp:recv(ServerSocket, 0),
ok = gen_udp:close(ServerSocket),
{ok, {_, _, Data}} = ResultOfReceive,
- <<"beam_stats.node_foo_host_bar.mem_type_foo:1|g\n">> = Data.
+ <<"beam_stats.node_foo_host_bar.memory.mem_type_foo:1|g\n">> = Data.