%% ============================================================================
-callback init(Options :: term()) ->
- {ConsumptionInterval :: erlang:time(), State :: term()}.
+ {ConsumptionInterval :: non_neg_integer(), State :: term()}.
-callback consume(queue(), State) ->
State.
-define(SIGNAL_CONSUMPTION , beam_stats_consumption_signal).
-record(state,
- { consumer_module :: atom()
+ { consumer_module :: module()
, consumer_state :: term()
- , consumption_interval :: erlang:time()
+ , consumption_interval :: non_neg_integer()
, beam_stats_queue :: queue()
}).
%% Public API
%% ============================================================================
--spec add(atom(), term()) ->
+-spec add(module(), term()) ->
supervisor:startchild_ret().
add(ConsumerModule, ConsumerOptions) ->
beam_stats_sup_consumers:start_child(ConsumerModule, ConsumerOptions).
_ = 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),