Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
5
files changed
+12
additions
-11
deletions
| @@ -29,7 +29,7 @@ telemetry_poller:start_link( | |
| 29 29 | {process_info, [{name, my_app_worker}, {event, [my_app, worker]}, {keys, [memory, message_queue_len]}]}, |
| 30 30 | {example_app_measurements, dispatch_session_count, []} |
| 31 31 | ]}, |
| 32 | - {period, 10000}, % configure sampling period - default is 5000 |
| 32 | + {period, timer:seconds(10)}, % configure sampling period - default is timer:seconds(5) |
| 33 33 | {name, my_app_poller} |
| 34 34 | ]). |
| 35 35 | ``` |
| @@ -64,7 +64,7 @@ end | |
| 64 64 | {:process_info, name: :my_app_worker, event: [:my_app, :worker], keys: [:message, :message_queue_len]}, |
| 65 65 | {ExampleApp.Measurements, :dispatch_session_count, []}, |
| 66 66 | ], |
| 67 | - period: 10_000, # configure sampling period - default is 5_000 |
| 67 | + period: :timer.seconds(10), # configure sampling period - default is :timer.seconds(5) |
| 68 68 | name: :my_app_poller |
| 69 69 | ) |
| 70 70 | ``` |
| @@ -16,4 +16,4 @@ | |
| 16 16 | [{<<"app">>,<<"telemetry">>}, |
| 17 17 | {<<"optional">>,false}, |
| 18 18 | {<<"requirement">>,<<"~> 0.4">>}]}]}. |
| 19 | - {<<"version">>,<<"0.5.0">>}. |
| 19 | + {<<"version">>,<<"0.5.1">>}. |
| @@ -1,4 +1,4 @@ | |
| 1 | - {erl_opts, [{platform_define, "19", 'OTP19'}, debug_info]}. |
| 1 | + {erl_opts, [{platform_define, "^19", 'OTP19'}, debug_info]}. |
| 2 2 | {deps, [ |
| 3 3 | {telemetry, "~> 0.4"} |
| 4 4 | ]}. |
| @@ -15,7 +15,7 @@ | |
| 15 15 | {covertool, [{coverdata_files, ["ct.coverdata"]}]} |
| 16 16 | ]}, |
| 17 17 | {docs, [{edoc_opts, [{preprocess, true}, |
| 18 | - {title, "Telemetry Poller v0.5.0"}]} |
| 18 | + {title, "Telemetry Poller v0.5.1"}]} |
| 19 19 | ]} |
| 20 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.5.0"}, |
| 3 | + {vsn,"0.5.1"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {mod,{telemetry_poller_app,[]}}, |
| 6 6 | {applications,[kernel,stdlib,telemetry]}, |
| @@ -76,7 +76,7 @@ | |
| 76 76 | %% <li>`atom_count' - number of atoms currently existing at the local node</li> |
| 77 77 | %% <li>`port_count' - number of ports currently existing at the local node</li> |
| 78 78 | %% </ul> |
| 79 | - %% |
| 79 | + %% |
| 80 80 | %% All three measurements are from {@link erlang:system_info/1}. |
| 81 81 | %% |
| 82 82 | %% == Process info == |
| @@ -201,7 +201,7 @@ | |
| 201 201 | -type t() :: gen_server:server(). |
| 202 202 | -type options() :: [option()]. |
| 203 203 | -type option() :: |
| 204 | - {name, gen_server:name()} |
| 204 | + {name, atom() | {global, atom()}, {via, module(), term()}} |
| 205 205 | | {period, period()} |
| 206 206 | | {measurements, [measurement()]}. |
| 207 207 | -type measurement() :: |
| @@ -217,13 +217,14 @@ | |
| 217 217 | %% |
| 218 218 | %% Useful for starting Pollers as a part of a supervision tree. |
| 219 219 | %% |
| 220 | - %% Default options: [{name, telemetry_poller}, {period, 5000}] |
| 220 | + %% Default options: [{name, telemetry_poller}, {period, timer:seconds(5)}] |
| 221 221 | -spec start_link(options()) -> gen_server:on_start(). |
| 222 222 | start_link(Opts) when is_list(Opts) -> |
| 223 223 | Args = parse_args(Opts), |
| 224 224 | |
| 225 225 | case lists:keyfind(name, 1, Opts) of |
| 226 | - {name, Name} -> gen_server:start_link({local, Name}, ?MODULE, Args, []); |
| 226 | + {name, Name} when is_atom(Name) -> gen_server:start_link({local, Name}, ?MODULE, Args, []); |
| 227 | + {name, Name} -> gen_server:start_link(Name, ?MODULE, Args, []); |
| 227 228 | false -> gen_server:start_link(?MODULE, Args, []) |
| 228 229 | end. |
| 229 230 | |
| @@ -259,7 +260,7 @@ child_spec(Opts) -> | |
| 259 260 | parse_args(Args) -> |
| 260 261 | Measurements = proplists:get_value(measurements, Args, []), |
| 261 262 | ParsedMeasurements = parse_measurements(Measurements), |
| 262 | - Period = proplists:get_value(period, Args, 5000), |
| 263 | + Period = proplists:get_value(period, Args, timer:seconds(5)), |
| 263 264 | validate_period(Period), |
| 264 265 | #{measurements => ParsedMeasurements, period => Period}. |