home
/
code
/
beam_stats.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: use new msg abstractions in StatsD consumer.
[beam_stats.git]
/
src
/
beam_stats_msg_graphite.erl
diff --git
a/src/beam_stats_msg_graphite.erl
b/src/beam_stats_msg_graphite.erl
index
6883ff1
..
c88e327
100644
(file)
--- a/
src/beam_stats_msg_graphite.erl
+++ b/
src/beam_stats_msg_graphite.erl
@@
-13,8
+13,11
@@
-export(
[ of_beam_stats/1
-export(
[ of_beam_stats/1
+ , of_beam_stats/2
, to_bin/1
, path_to_bin/1
, to_bin/1
, path_to_bin/1
+ , add_path_prefix/2
+ , node_id_to_bin/1
]).
-define(T, #?MODULE).
]).
-define(T, #?MODULE).
@@
-76,11
+79,22
@@
to_bin(
TimestampBin = integer_to_binary(TimestampInt),
<<PathBin/binary, " ", ValueBin/binary, " ", TimestampBin/binary>>.
TimestampBin = integer_to_binary(TimestampInt),
<<PathBin/binary, " ", ValueBin/binary, " ", TimestampBin/binary>>.
+-spec add_path_prefix(t(), binary()) ->
+ t().
+add_path_prefix(?T{path=Path}=T, <<Prefix/binary>>) ->
+ T?T{path = [Prefix | Path]}.
+
-spec path_to_bin([binary()]) ->
binary().
path_to_bin(Path) ->
bin_join(Path, <<".">>).
-spec path_to_bin([binary()]) ->
binary().
path_to_bin(Path) ->
bin_join(Path, <<".">>).
+-spec node_id_to_bin(node()) ->
+ binary().
+node_id_to_bin(NodeID) ->
+ NodeIDBin = atom_to_binary(NodeID, utf8),
+ re:replace(NodeIDBin, "[\@\.]", "_", [global, {return, binary}]).
+
%% ============================================================================
%% Helpers
%% ============================================================================
%% ============================================================================
%% Helpers
%% ============================================================================
@@
-251,9
+265,3
@@
cons(Path, Value, Timestamp) ->
, value = Value
, timestamp = Timestamp
}.
, value = Value
, timestamp = Timestamp
}.
-
--spec node_id_to_bin(node()) ->
- binary().
-node_id_to_bin(NodeID) ->
- NodeIDBin = atom_to_binary(NodeID, utf8),
- re:replace(NodeIDBin, "[\@\.]", "_", [global, {return, binary}]).
This page took
0.034021 seconds
and
4
git commands to generate.