Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
7
files changed
+44
additions
-10
deletions
| @@ -9,6 +9,7 @@ Allows to periodically collect measurements and dispatch them as Telemetry event | |
| 9 9 | |
| 10 10 | * `[vm, memory]` - contains the total memory, process memory, and all other keys in `erlang:memory/0` |
| 11 11 | * `[vm, total_run_queue_lengths]` - returns the run queue lengths for CPU and IO schedulers. It contains the `total`, `cpu` and `io` measurements |
| 12 | + * `[vm, system_counts]` - returns the current process, atom and port count as per `erlang:system_info/1` |
| 12 13 | |
| 13 14 | You can directly consume those events after adding `telemetry_poller` as a dependency. |
| @@ -16,4 +16,4 @@ | |
| 16 16 | [{<<"app">>,<<"telemetry">>}, |
| 17 17 | {<<"optional">>,false}, |
| 18 18 | {<<"requirement">>,<<"~> 0.4">>}]}]}. |
| 19 | - {<<"version">>,<<"0.4.1">>}. |
| 19 | + {<<"version">>,<<"0.5.0">>}. |
| @@ -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.4.1"}]} |
| 18 | + {title, "Telemetry Poller v0.5.0"}]} |
| 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.4.1"}, |
| 3 | + {vsn,"0.5.0"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {mod,{telemetry_poller_app,[]}}, |
| 6 6 | {applications,[kernel,stdlib,telemetry]}, |
| @@ -17,12 +17,13 @@ | |
| 17 17 | %% |
| 18 18 | %% * `memory' (default) |
| 19 19 | %% * `total_run_queue_lengths' (default) |
| 20 | + %% * `system_counts' (default) |
| 20 21 | %% * `{process_info, Proplist}' |
| 21 22 | %% * `{Module, Function, Args}' |
| 22 23 | %% |
| 23 24 | %% We will discuss each measurement in detail. Also note that the |
| 24 25 | %% telemetry_poller application ships with a built-in poller that |
| 25 | - %% measures both `memory' and `total_run_queue_lengths'. This takes |
| 26 | + %% measures `memory', `total_run_queue_lengths' and `system_counts'. This takes |
| 26 27 | %% the VM measurement out of the way so your application can focus |
| 27 28 | %% on what is specific to its behaviour. |
| 28 29 | %% |
| @@ -65,6 +66,19 @@ | |
| 65 66 | %% However, the value is accurate enough to help to identify issues in a |
| 66 67 | %% running system. |
| 67 68 | %% |
| 69 | + %% == System counts == |
| 70 | + %% |
| 71 | + %% An event emitted as `[vm, system_counts]'. The event contains no metadata |
| 72 | + %% and three measurements: |
| 73 | + %% |
| 74 | + %% <ul> |
| 75 | + %% <li>`process_count' - number of process currently existing at the local node</li> |
| 76 | + %% <li>`atom_count' - number of atoms currently existing at the local node</li> |
| 77 | + %% <li>`port_count' - number of ports currently existing at the local node</li> |
| 78 | + %% </ul> |
| 79 | + %% |
| 80 | + %% All three measurements are from {@link erlang:system_info/1}. |
| 81 | + %% |
| 68 82 | %% == Process info == |
| 69 83 | %% |
| 70 84 | %% A measurement with information about a given process. It must be specified |
| @@ -175,11 +189,6 @@ | |
| 175 189 | -include_lib("kernel/include/logger.hrl"). |
| 176 190 | -else. |
| 177 191 | -define(LOG_ERROR(Msg, Args), error_logger:error_msg(Msg, Args)). |
| 178 | - -endif. |
| 179 | - |
| 180 | - -ifdef('OTP_RELEASE'). |
| 181 | - -include_lib("kernel/include/logger.hrl"). |
| 182 | - -else. |
| 183 192 | -define(LOG_WARNING(Msg, Args), error_logger:warning_msg(Msg, Args)). |
| 184 193 | -endif. |
| 185 194 | |
| @@ -198,6 +207,7 @@ | |
| 198 207 | -type measurement() :: |
| 199 208 | memory |
| 200 209 | | total_run_queue_lengths |
| 210 | + | system_counts |
| 201 211 | | {process_info, [{name, atom()} | {event, [atom()]} | {keys, [atom()]}]} |
| 202 212 | | {module(), atom(), list()}. |
| 203 213 | -type period() :: pos_integer(). |
| @@ -274,6 +284,8 @@ parse_measurement(memory) -> | |
| 274 284 | {telemetry_poller_builtin, memory, []}; |
| 275 285 | parse_measurement(total_run_queue_lengths) -> |
| 276 286 | {telemetry_poller_builtin, total_run_queue_lengths, []}; |
| 287 | + parse_measurement(system_counts) -> |
| 288 | + {telemetry_poller_builtin, system_counts, []}; |
| 277 289 | parse_measurement({process_info, List}) when is_list(List) -> |
| 278 290 | Name = case proplists:get_value(name, List) of |
| 279 291 | undefined -> erlang:error({badarg, "Expected `name' key to be given under process_info measurement"}); |
Loading more files…