Current section

11 Versions

Jump to

Compare versions

17 files changed
+535 additions
-694 deletions
  @@ -1,10 +0,0 @@
1 - # Used by "mix format"
2 - [
3 - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"],
4 - locals_without_parens: [
5 - assert_dispatched: 3,
6 - assert_dispatched: 4,
7 - assert_dispatch: 4,
8 - on_exit: 1
9 - ]
10 - ]
  @@ -1,67 +0,0 @@
1 - # Changelog
2 -
3 - All notable changes to this project will be documented in this file.
4 -
5 - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 - and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 -
8 - ## [0.3.0](https://github.com/beam-telemetry/telemetry_poller/tree/v0.3.0)
9 -
10 - This release marks the upgrade to Telemetry 0.4.0. This means that Poller measurements can emit a map
11 - of values now instead of a single one, making it less "noisy" when it comes to number of emitted events.
12 -
13 - All specific memory measurements have been replaced with a single `:memory` measurement sending all
14 - the values that were emitted by old measurements at once.
15 -
16 - `:run_queue_lengths` VM measurement has been removed for now, as we believe that as detailed data
17 - as it provided is not necessary to effectively debug the system. `:total_run_queue_lengths` VM
18 - measurement has been changed so that it reports a `:total` length of run queues, length of `:cpu`
19 - run queues (including dirty CPU run queue), and length of (dirty) `:io` run queue.
20 -
21 - ### Added
22 -
23 - - `:memory` VM measurement reporting all the data returned by `:erlang.memory/0` call.
24 -
25 - ### Changed
26 -
27 - - `:total_run_queue_lengths` VM measurement is reporting a `:total`, `:cpu` and `:io` run queue lengths
28 - now. See documentation for more details.
29 -
30 - ### Removed
31 -
32 - - `:total_memory`, `:atom_memory`, `:atom_used_memory`, `:processes_memory`, `:processes_used_memory`,
33 - `:binary_memory`, `:ets_memory`, `:code_memory` and `:system_memory` VM measurements have been removed.
34 - Please use the `:memory` measurement now instead.
35 -
36 - ## [0.2.0](https://github.com/beam-telemetry/telemetry_poller/tree/v0.2.0)
37 -
38 - ### Added
39 -
40 - - Added `:total_run_queue_lengths` and `:run_queue_lengths` memory measurements;
41 -
42 - ### Changed
43 -
44 - - `:total_run_queue_lengths` is now included in the set of default VM measurements;
45 - - A default Poller process, with a default set of VM measurements, is started when `:telemetry_poller`
46 - application starts (configurable via `:telemetry.poller, :default` application environment).
47 - - VM measurements are now provided to Poller's `:vm_measurements` option. Passing atom `:default`
48 - to this option makes the Poller use a default set of VM measurements;
49 - - Telemetry has been upgraded to version 0.3, meaning that VM measurements now use this version to
50 - emit the events.
51 -
52 - ### Removed
53 -
54 - - `Telemetry.Poller.vm_measurements/0` function has been removed in favor of `:vm_measurements`
55 - option.
56 -
57 - ### Fixed
58 -
59 - - Fixed the type definition of `Telemetry.Poller.measurement/0` type - no Dialyzer warnings are
60 - emitted when running it on the project.
61 -
62 - ## [0.1.0](https://github.com/beam-telemetry/telemetry_poller/tree/v0.1.0)
63 -
64 - ### Added
65 -
66 - - The Poller process periodically invoking registered functions which emit Telemetry events.
67 - It supports VM memory measurements and custom measurements provided as MFAs.
  @@ -174,29 +174,4 @@
174 174 incurred by, or claims asserted against, such Contributor by reason
175 175 of your accepting any such warranty or additional liability.
176 176
177 - END OF TERMS AND CONDITIONS
178 -
179 - APPENDIX: How to apply the Apache License to your work.
180 -
181 - To apply the Apache License to your work, attach the following
182 - boilerplate notice, with the fields enclosed by brackets "[]"
183 - replaced with your own identifying information. (Don't include
184 - the brackets!) The text should be enclosed in the appropriate
185 - comment syntax for the file format. We also recommend that a
186 - file or class name and description of purpose be included on the
187 - same "printed page" as the copyright notice for easier
188 - identification within third-party archives.
189 -
190 - Copyright [yyyy] [name of copyright owner]
191 -
192 - Licensed under the Apache License, Version 2.0 (the "License");
193 - you may not use this file except in compliance with the License.
194 - You may obtain a copy of the License at
195 -
196 - http://www.apache.org/licenses/LICENSE-2.0
197 -
198 - Unless required by applicable law or agreed to in writing, software
199 - distributed under the License is distributed on an "AS IS" BASIS,
200 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 - See the License for the specific language governing permissions and
202 - limitations under the License.
177 + END OF TERMS AND CONDITIONS
\ No newline at end of file
  @@ -0,0 +1,13 @@
1 + Copyright (c) 2018, Chris McCord and Erlang Solutions
2 +
3 + Licensed under the Apache License, Version 2.0 (the "License");
4 + you may not use this file except in compliance with the License.
5 + You may obtain a copy of the License at
6 +
7 + http://www.apache.org/licenses/LICENSE-2.0
8 +
9 + Unless required by applicable law or agreed to in writing, software
10 + distributed under the License is distributed on an "AS IS" BASIS,
11 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 + See the License for the specific language governing permissions and
13 + limitations under the License.
\ No newline at end of file
  @@ -1,42 +1,80 @@
1 - # Telemetry.Poller
1 + # telemetry_poller
2 2
3 3 [![CircleCI](https://circleci.com/gh/beam-telemetry/telemetry_poller.svg?style=svg)](https://circleci.com/gh/beam-telemetry/telemetry_poller)
4 4 [![Codecov](https://codecov.io/gh/beam-telemetry/telemetry_poller/branch/master/graphs/badge.svg)](https://codecov.io/gh/beam-telemetry/telemetry_poller/branch/master/graphs/badge.svg)
5 5
6 6 Allows to periodically collect measurements and dispatch them as Telemetry events.
7 7
8 - `Telemetry.Poller` ships with a default poller for VM measurements:
8 + `telemetry_poller` by default runs a poller to perform VM measurements:
9 9
10 - ```elixir
11 - config :telemetry_poller, :default,
12 - vm_measurements: :default # or a list such as [:memory, ...]
10 + * `[vm, memory]` - contains the total memory, process memory, and all other keys in `erlang:memory/0`
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 +
13 + You can directly consume those events after adding `telemetry_poller` as a dependency.
14 +
15 + Poller also provides a convenient API for running custom pollers.
16 +
17 + ## Defining custom measurements
18 +
19 + Poller also includes conveniences for performing process-based measurements as well as custom ones.
20 +
21 + ### Erlang
22 +
23 + First define the poller with the custom measurements. The first measurement is the built-in `process_info` measurement and the second one is given by a custom module-function-args defined by you:
24 +
25 + ```erlang
26 + telemetry_poller:start_link(
27 + [{measurements, [
28 + {process_info, [{name, my_app_worker}, {event, [my_app, worker]}, {keys, [memory, message_queue_len]}]},
29 + {example_app_measurements, dispatch_session_count, []}
30 + ]},
31 + {period, 10000} % configure sampling period - default is 5000
32 + ]).
13 33 ```
14 34
15 - Poller also provides a convenient API for specifying functions called periodically to dispatch
16 - measurements as Telemetry events:
35 + Now define the custom measurement and you are good to go:
36 +
37 + ```erlang
38 + -module(example_app_measurements).
39 +
40 + dispatch_session_count() ->
41 + % emit a telemetry event when called
42 + telemetry:execute([example_app, session_count], #{count => example_app:session_count()}, #{}).
43 + ```
44 +
45 + ### Elixir
46 +
47 + First define the poller with the custom measurements. The first measurement is the built-in `process_info` measurement and the second one is given by a custom module-function-args defined by you:
17 48
18 49 ```elixir
19 - # define custom function dispatching event with value you're interested in
20 50 defmodule ExampleApp.Measurements do
21 51 def dispatch_session_count() do
22 - :telemetry.execute([:example_app, :session_count], ExampleApp.session_count())
52 + # emit a telemetry event when called
53 + :telemetry.execute([:example_app, :session_count], %{count: ExampleApp.session_count()}, %{})
23 54 end
24 55 end
56 + ```
25 57
26 - Telemetry.Poller.start_link(
27 - # include custom measurement
58 + ```elixir
59 + :telemetry_poller.start_link(
60 + # include custom measurement as an MFA tuple
28 61 measurements: [
29 - {ExampleApp.Measurements, :dispatch_session_count, []}
62 + {:process_info, name: :my_app_worker, event: [:my_app, :worker], keys: [:message, :message_queue_len]},
63 + {ExampleApp.Measurements, :dispatch_session_count, []},
30 64 ],
31 - period: 10_000 # configure sampling period
65 + period: 10_000 # configure sampling period - default is 5_000
32 66 )
33 67 ```
34 68
35 - See [documentation](https://hexdocs.pm/telemetry_poller/0.3.0) for more concrete examples and usage
69 + ## Documentation
70 +
71 + See [documentation](https://hexdocs.pm/telemetry_poller/) for more concrete examples and usage
36 72 instructions.
37 73
38 74 ## Copyright and License
39 75
40 - Copyright (c) 2018, Chris McCord and Erlang Solutions.
76 + telemetry_poller is copyright (c) 2018 Chris McCord and Erlang Solutions.
41 77
42 - Telemetry source code is licensed under the [Apache License, Version 2.0](LICENSE).
78 + telemetry_poller source code is released under Apache License, Version 2.0.
79 +
80 + See [LICENSE](LICENSE) and [NOTICE](NOTICE) files for more information.
Loading more files…