%% ============================================================================
-spec production_interval() ->
- erlang:time().
+ non_neg_integer().
production_interval() ->
get_env(production_interval).
%% ============================================================================
-callback init(Options :: term()) ->
- {ConsumptionInterval :: erlang:time(), State :: term()}.
+ {ConsumptionInterval :: non_neg_integer(), State :: term()}.
-callback consume(queue(), State) ->
State.
-record(state,
{ consumer_module :: atom()
, consumer_state :: term()
- , consumption_interval :: erlang:time()
+ , consumption_interval :: non_neg_integer()
, beam_stats_queue :: queue()
}).
_ = self() ! ?SIGNAL_CONSUMPTION,
ok.
--spec schedule_next_consumption(erlang:time()) ->
+-spec schedule_next_consumption(non_neg_integer()) ->
ok.
schedule_next_consumption(Time) ->
_ = erlang:send_after(Time, self(), ?SIGNAL_CONSUMPTION),
-type option() ::
{path , file:filename()}
- | {consumption_interval , erlang:time()}
+ | {consumption_interval , non_neg_integer()}
.
-record(state,
#state{}.
-spec init([option()]) ->
- {erlang:time(), state()}.
+ {non_neg_integer(), state()}.
init(Options) ->
ConsumptionInterval = hope_kv_list:get(Options, consumption_interval, 60000),
{some, Path} = hope_kv_list:get(Options, path),
-type option() ::
{connect_options , [connect_option()]}
- | {consumption_interval , erlang:time()}
+ | {consumption_interval , non_neg_integer()}
.
-record(state,
-define(GRAPHITE_PATH_PREFIX, "beam_stats").
-spec init([option()]) ->
- {erlang:time(), state()}.
+ {non_neg_integer(), state()}.
init(Options) ->
ConnectOptions = hope_kv_list:get(Options, connect_options , []),
ConsumptionInterval = hope_kv_list:get(Options, consumption_interval, 60000),
]).
-type option() ::
- {consumption_interval , erlang:time()}
+ {consumption_interval , non_neg_integer()}
| {dst_host , inet:ip_address() | inet:hostname()}
| {dst_port , inet:port_number()}
| {src_port , inet:port_number()}
%% ============================================================================
-spec init([option()]) ->
- {erlang:time(), state()}.
+ {non_neg_integer(), state()}.
init(Options) ->
ConsumptionInterval = hope_kv_list:get(Options, consumption_interval, 60000),
DstHost = hope_kv_list:get(Options, dst_host, ?DEFAULT_DST_HOST),