home
/
code
/
beam_stats.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
53bff5d
)
Include the metric type in it's name.
0.1.0
author
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 23 Aug 2015 22:04:06 +0000
(18:04 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 23 Aug 2015 22:04:06 +0000
(18:04 -0400)
src/beam_stats.app.src
patch
|
blob
|
blame
|
history
src/beam_stats_consumer_csv.erl
patch
|
blob
|
blame
|
history
src/beam_stats_consumer_graphite.erl
patch
|
blob
|
blame
|
history
src/beam_stats_consumer_statsd.erl
patch
|
blob
|
blame
|
history
test/beam_stats_consumer_statsd_SUITE.erl
patch
|
blob
|
blame
|
history
diff --git
a/src/beam_stats.app.src
b/src/beam_stats.app.src
index
9f5c428
..
e6b3ab7
100644
(file)
--- a/
src/beam_stats.app.src
+++ b/
src/beam_stats.app.src
@@
-1,7
+1,7
@@
{application, beam_stats,
[
{description, "Periodic VM stats production and consumption."},
{application, beam_stats,
[
{description, "Periodic VM stats production and consumption."},
- {vsn, "0.
0.1
"},
+ {vsn, "0.
1.0
"},
{registered, []},
{applications,
[ kernel
{registered, []},
{applications,
[ kernel
diff --git
a/src/beam_stats_consumer_csv.erl
b/src/beam_stats_consumer_csv.erl
index
c9d2785
..
6b27106
100644
(file)
--- a/
src/beam_stats_consumer_csv.erl
+++ b/
src/beam_stats_consumer_csv.erl
@@
-101,9
+101,9
@@
beam_stats_to_bin(#beam_stats
) ->
<<TimestampBin/binary>> = timestamp_to_bin(Timestamp),
<<NodeIDBin/binary>> = node_id_to_bin(NodeID),
) ->
<<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),
MemoryBinPairs = lists:map(fun atom_int_to_bin_bin/1, Memory),
- MemoryBins = lists:map(PairToBin, MemoryBinPairs),
+ MemoryBins = lists:map(
Memory
PairToBin, MemoryBinPairs),
AllBins =
[ MemoryBins
],
AllBins =
[ MemoryBins
],
@@
-131,14
+131,16
@@
timestamp_to_float({ComponentMega, ComponentWhole, ComponentMicro}) ->
TotalMicroSeconds = (TotalWholeSeconds * OneMillion) + ComponentMicro,
TotalMicroSeconds / OneMillion.
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()).
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
, "|"
fun ({<<K/binary>>, <<V/binary>>}) ->
<< TimestampBin/binary
, "|"
, NodeID/binary
, "|"
+ , Type/binary
+ , "|"
, K/binary
, "|"
, V/binary
, K/binary
, "|"
, V/binary
diff --git
a/src/beam_stats_consumer_graphite.erl
b/src/beam_stats_consumer_graphite.erl
index
e788d29
..
6e0d5dd
100644
(file)
--- a/
src/beam_stats_consumer_graphite.erl
+++ b/
src/beam_stats_consumer_graphite.erl
@@
-123,9
+123,9
@@
beam_stats_to_bin(#beam_stats
TimestampInt = timestamp_to_integer(Timestamp),
TimestampBin = integer_to_binary(TimestampInt),
<<NodeIDBin/binary>> = node_id_to_bin(NodeID),
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),
MemoryBinPairs = lists:map(fun atom_int_to_bin_bin/1, Memory),
- MemoryBins = lists:map(PairToBin, MemoryBinPairs),
+ MemoryBins = lists:map(
Memory
PairToBin, MemoryBinPairs),
AllBins =
[ MemoryBins
],
AllBins =
[ MemoryBins
],
@@
-136,14
+136,16
@@
beam_stats_to_bin(#beam_stats
timestamp_to_integer({Megaseconds, Seconds, _}) ->
Megaseconds * 1000000 + Seconds.
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()).
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
, "."
fun ({<<K/binary>>, <<V/binary>>}) ->
<< ?GRAPHITE_PATH_PREFIX
, "."
, NodeID/binary
, "."
+ , Type/binary
+ , "."
, K/binary
, " "
, V/binary
, K/binary
, " "
, V/binary
diff --git
a/src/beam_stats_consumer_statsd.erl
b/src/beam_stats_consumer_statsd.erl
index
70ed8dc
..
f5828bf
100644
(file)
--- a/
src/beam_stats_consumer_statsd.erl
+++ b/
src/beam_stats_consumer_statsd.erl
@@
-157,8
+157,9
@@
memory_to_msgs(Memory) ->
-spec memory_component_to_statsd_msg({atom(), non_neg_integer()}) ->
statsd_msg().
memory_component_to_statsd_msg({MemType, MemSize}) when MemSize >= 0 ->
-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
#statsd_msg
- { name =
atom_to_binary(MemType, latin1)
+ { name =
<<"memory.", MemTypeBin/binary>>
, value = MemSize
, type = gauge
}.
, value = MemSize
, type = gauge
}.
diff --git
a/test/beam_stats_consumer_statsd_SUITE.erl
b/test/beam_stats_consumer_statsd_SUITE.erl
index
f5fbc0b
..
9c7e175
100644
(file)
--- a/
test/beam_stats_consumer_statsd_SUITE.erl
+++ b/
test/beam_stats_consumer_statsd_SUITE.erl
@@
-48,4
+48,4
@@
t_send(_Cfg) ->
ResultOfReceive = gen_udp:recv(ServerSocket, 0),
ok = gen_udp:close(ServerSocket),
{ok, {_, _, Data}} = ResultOfReceive,
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.mem
ory.mem
_type_foo:1|g\n">> = Data.
This page took
0.025171 seconds
and
4
git commands to generate.