fix: add missing spec
[beam_stats.git] / src / beam_stats_msg_statsd_gauge.erl
CommitLineData
9b9299d9
SK
1-module(beam_stats_msg_statsd_gauge).
2
3-include("include/beam_stats_msg_graphite.hrl").
4-include("include/beam_stats_msg_statsd_gauge.hrl").
5
6-export_type(
7 [ t/0
8 ]).
9
10-export(
11 [ of_msg_graphite/1
12 , to_bin/1
13 ]).
14
15-define(T, #?MODULE).
16
17-type t() ::
18 ?T{}.
19
808e1732
SK
20-spec of_msg_graphite(beam_stats_msg_graphite:t()) ->
21 t().
9b9299d9
SK
22of_msg_graphite(
23 #beam_stats_msg_graphite
24 { path = Path
25 , value = Value
26 , timestamp = _Timestamp
27 }
28) ->
29 PathBin = beam_stats_msg_graphite:path_to_bin(Path),
30 cons(PathBin, Value).
31
32-spec cons(binary(), non_neg_integer()) ->
33 t().
34cons(<<Name/binary>>, Value) ->
35 ?T
36 { name = Name
37 , value = Value
38 }.
39
40-spec to_bin(t()) ->
41 binary().
42to_bin(
43 ?T
44 { name = <<Name/binary>>
45 , value = Value
46 }
47) when Value >= 0 ->
48 ValueBin = integer_to_binary(Value),
49 << Name/binary, ":", ValueBin/binary, "|g\n">>.
This page took 0.030252 seconds and 4 git commands to generate.