Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
5
files changed
+25
additions
-16
deletions
| @@ -28,7 +28,8 @@ telemetry_poller:start_link( | |
| 28 28 | {process_info, [{name, my_app_worker}, {event, [my_app, worker]}, {keys, [memory, message_queue_len]}]}, |
| 29 29 | {example_app_measurements, dispatch_session_count, []} |
| 30 30 | ]}, |
| 31 | - {period, 10000} % configure sampling period - default is 5000 |
| 31 | + {period, 10000}, % configure sampling period - default is 5000 |
| 32 | + {name, my_app_poller} |
| 32 33 | ]). |
| 33 34 | ``` |
| 34 35 | |
| @@ -62,7 +63,8 @@ end | |
| 62 63 | {:process_info, name: :my_app_worker, event: [:my_app, :worker], keys: [:message, :message_queue_len]}, |
| 63 64 | {ExampleApp.Measurements, :dispatch_session_count, []}, |
| 64 65 | ], |
| 65 | - period: 10_000 # configure sampling period - default is 5_000 |
| 66 | + period: 10_000, # configure sampling period - default is 5_000 |
| 67 | + name: :my_app_poller |
| 66 68 | ) |
| 67 69 | ``` |
| @@ -1,16 +1,19 @@ | |
| 1 | - {<<"name">>,<<"telemetry_poller">>}. |
| 2 | - {<<"version">>,<<"0.4.0">>}. |
| 3 | - {<<"requirements">>,#{}}. |
| 4 1 | {<<"app">>,<<"telemetry_poller">>}. |
| 5 | - {<<"precompiled">>,false}. |
| 2 | + {<<"build_tools">>,[<<"rebar3">>]}. |
| 6 3 | {<<"description">>, |
| 7 4 | <<"Periodically collect measurements and dispatch them as Telemetry events.">>}. |
| 8 5 | {<<"files">>, |
| 9 | - [<<"src/telemetry_poller.app.src">>,<<"LICENSE">>,<<"NOTICE">>, |
| 10 | - <<"README.md">>,<<"rebar.config">>,<<"rebar.lock">>, |
| 6 | + [<<"LICENSE">>,<<"NOTICE">>,<<"README.md">>,<<"rebar.config">>, |
| 7 | + <<"rebar.lock">>,<<"src/telemetry_poller.app.src">>, |
| 11 8 | <<"src/telemetry_poller.erl">>,<<"src/telemetry_poller_app.erl">>, |
| 12 9 | <<"src/telemetry_poller_builtin.erl">>,<<"src/telemetry_poller_sup.erl">>]}. |
| 13 10 | {<<"licenses">>,[<<"Apache 2.0">>]}. |
| 14 11 | {<<"links">>, |
| 15 12 | [{<<"Github">>,<<"https://github.com/beam-telemetry/telemetry_poller">>}]}. |
| 16 | - {<<"build_tools">>,[<<"rebar3">>]}. |
| 13 | + {<<"name">>,<<"telemetry_poller">>}. |
| 14 | + {<<"requirements">>, |
| 15 | + [{<<"telemetry">>, |
| 16 | + [{<<"app">>,<<"telemetry">>}, |
| 17 | + {<<"optional">>,false}, |
| 18 | + {<<"requirement">>,<<"~> 0.4">>}]}]}. |
| 19 | + {<<"version">>,<<"0.4.1">>}. |
| @@ -5,7 +5,6 @@ | |
| 5 5 | |
| 6 6 | {profiles, [ |
| 7 7 | {test, [{erl_opts, [nowarn_export_all]}, |
| 8 | - {deps, []}, |
| 9 8 | %% create junit xml for circleci |
| 10 9 | {ct_opts, [{ct_hooks, [cth_surefire]}]}, |
| 11 10 | {cover_enabled, true}, |
| @@ -16,7 +15,7 @@ | |
| 16 15 | {covertool, [{coverdata_files, ["ct.coverdata"]}]} |
| 17 16 | ]}, |
| 18 17 | {docs, [{edoc_opts, [{preprocess, true}, |
| 19 | - {title, "Telemetry Poller v0.4.0"}]} |
| 18 | + {title, "Telemetry Poller v0.4.1"}]} |
| 20 19 | ]} |
| 21 20 | ]}. |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {application,telemetry_poller, |
| 2 2 | [{description,"Periodically collect measurements and dispatch them as Telemetry events."}, |
| 3 | - {vsn,"0.4.0"}, |
| 3 | + {vsn,"0.4.1"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {mod,{telemetry_poller_app,[]}}, |
| 6 6 | {applications,[kernel,stdlib,telemetry]}, |
| @@ -33,7 +33,7 @@ | |
| 33 33 | %% e.g. `total' for total memory, `processes_used' for memory used by |
| 34 34 | %% all processes, etc. |
| 35 35 | %% |
| 36 | - %% == Total run queue lengths === |
| 36 | + %% == Total run queue lengths == |
| 37 37 | %% |
| 38 38 | %% On startup, the Erlang VM starts many schedulers to do both IO and |
| 39 39 | %% CPU work. If a process needs to do some work or wait on IO, it is |
| @@ -81,7 +81,7 @@ | |
| 81 81 | %% |
| 82 82 | %% The `keys' is a list of atoms accepted by {@link erlang:process_info/2}. |
| 83 83 | %% |
| 84 | - %% == Custom measurements === |
| 84 | + %% == Custom measurements == |
| 85 85 | %% |
| 86 86 | %% Telemetry poller also allows you to perform custom measurements by passing |
| 87 87 | %% a module-function-args tuple: |
| @@ -206,11 +206,16 @@ | |
| 206 206 | %% @doc Starts a poller linked to the calling process. |
| 207 207 | %% |
| 208 208 | %% Useful for starting Pollers as a part of a supervision tree. |
| 209 | + %% |
| 210 | + %% Default options: [{name, telemetry_poller}, {period, 5000}] |
| 209 211 | -spec start_link(options()) -> gen_server:on_start(). |
| 210 212 | start_link(Opts) when is_list(Opts) -> |
| 211 | - Name = proplists:get_value(name, Opts, ?MODULE), |
| 212 213 | Args = parse_args(Opts), |
| 213 | - gen_server:start_link({local, Name}, ?MODULE, Args, []). |
| 214 | + |
| 215 | + case lists:keyfind(name, 1, Opts) of |
| 216 | + {name, Name} -> gen_server:start_link({local, Name}, ?MODULE, Args, []); |
| 217 | + false -> gen_server:start_link(?MODULE, Args, []) |
| 218 | + end. |
| 214 219 | |
| 215 220 | %% @doc |
| 216 221 | %% Returns a list of measurements used by the poller. |