Fix missing newline in Graphite msg serialization
[beam_stats.git] / src / beam_stats_sup_consumers.erl
CommitLineData
caf75ed8
SK
1-module(beam_stats_sup_consumers).
2
3-behaviour(supervisor).
4
5%% API
6-export(
7 [ start_link/0
8 , start_child/2
9 ]).
10
11%% Supervisor callbacks
12-export([init/1]).
13
14%% Helper macro for declaring children of supervisor
15-define(CHILD(Type, Module, Args),
16 {make_ref(), {Module, start_link, Args}, permanent, 5000, Type, [Module]}).
17
18%% ===================================================================
19%% API
20%% ===================================================================
21
22start_link() ->
23 supervisor:start_link({local, ?MODULE}, ?MODULE, []).
24
25start_child(Module, Options) ->
26 Child = ?CHILD(worker, beam_stats_consumer, [Module, Options]),
27 supervisor:start_child(?MODULE, Child).
28
29%% ===================================================================
30%% Supervisor callbacks
31%% ===================================================================
32
33init([]) ->
34 Consumers = beam_stats_config:consumers(),
35 ConsumerSpecToChild =
36 fun ({Module, Options}) ->
37 ?CHILD(worker, beam_stats_consumer, [Module, Options])
38 end,
39 Children = lists:map(ConsumerSpecToChild, Consumers),
40 SupFlags = {one_for_one, 5, 10},
41 {ok, {SupFlags, Children}}.
This page took 0.023182 seconds and 4 git commands to generate.