X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=src%2Fbeam_stats_msg_statsd_gauge.erl;h=4f4c533a799516ec02e8abecf3a395dc97983286;hb=e1221e429959c3184223b8e174ceb503e59781ba;hp=07e5d021c6960f604a50540f1079373de1cd668e;hpb=9b9299d9a59c8e5236c49c048846c9c4d5ed4a8b;p=beam_stats.git diff --git a/src/beam_stats_msg_statsd_gauge.erl b/src/beam_stats_msg_statsd_gauge.erl index 07e5d02..4f4c533 100644 --- a/src/beam_stats_msg_statsd_gauge.erl +++ b/src/beam_stats_msg_statsd_gauge.erl @@ -9,7 +9,7 @@ -export( [ of_msg_graphite/1 - , to_bin/1 + , to_iolist/1 ]). -define(T, #?MODULE). @@ -17,6 +17,8 @@ -type t() :: ?T{}. +-spec of_msg_graphite(beam_stats_msg_graphite:t()) -> + t(). of_msg_graphite( #beam_stats_msg_graphite { path = Path @@ -24,24 +26,24 @@ of_msg_graphite( , timestamp = _Timestamp } ) -> - PathBin = beam_stats_msg_graphite:path_to_bin(Path), - cons(PathBin, Value). + PathIOList = beam_stats_msg_graphite:path_to_iolist(Path), + cons(PathIOList, Value). --spec cons(binary(), non_neg_integer()) -> +-spec cons(iolist(), non_neg_integer()) -> t(). -cons(<>, Value) -> +cons(Name, Value) -> ?T { name = Name , value = Value }. --spec to_bin(t()) -> - binary(). -to_bin( +-spec to_iolist(t()) -> + iolist(). +to_iolist( ?T - { name = <> + { name = Name , value = Value } ) when Value >= 0 -> ValueBin = integer_to_binary(Value), - << Name/binary, ":", ValueBin/binary, "|g\n">>. + [Name, <<":">>, ValueBin, <<"|g\n">>].