Current section

11 Versions

Jump to

Compare versions

6 files changed
+104 additions
-40 deletions
  @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 7
8 + ## [1.1.0](https://github.com/beam-telemetry/telemetry_poller/tree/v1.1.0)
9 +
10 + ### Added
11 +
12 + - Add the `init_delay` configuration option. (#70)
13 +
8 14 ## [1.0.0](https://github.com/beam-telemetry/telemetry_poller/tree/v1.0.0)
9 15
10 16 This release marks stability of the API. The library now requires Telemetry ~> 1.0.
  @@ -29,6 +29,7 @@ telemetry_poller:start_link(
29 29 {example_app_measurements, dispatch_session_count, []}
30 30 ]},
31 31 {period, timer:seconds(10)}, % configure sampling period - default is timer:seconds(5)
32 + {init_delay, timer:seconds(600)}, % configure sampling initial delay - default is 0
32 33 {name, my_app_poller}
33 34 ]).
34 35 ```
  @@ -45,7 +46,25 @@ dispatch_session_count() ->
45 46
46 47 ### Elixir
47 48
48 - 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:
49 + You typically start the poller as a child in your supervision tree:
50 +
51 + ```elixir
52 + children = [
53 + {:telemetry_poller,
54 + # include custom measurement as an MFA tuple
55 + measurements: [
56 + {:process_info, name: :my_app_worker, event: [:my_app, :worker], keys: [:memory, :message_queue_len]},
57 + {ExampleApp.Measurements, :dispatch_session_count, []},
58 + ],
59 + period: :timer.seconds(10), # configure sampling period - default is :timer.seconds(5)
60 + init_delay: :timer.seconds(600), # configure sampling initial delay - default is 0
61 + name: :my_app_poller}
62 + ]
63 +
64 + Supervisor.start_link(children, strategy: :one_for_one)
65 + ```
66 +
67 + The poller above has two periodic measurements. The first is the built-in `process_info` measurement that will gather the memory and message queue length of a process. The second is given by a custom module-function-args defined by you, such as below:
49 68
50 69 ```elixir
51 70 defmodule ExampleApp.Measurements do
  @@ -56,26 +75,45 @@ defmodule ExampleApp.Measurements do
56 75 end
57 76 ```
58 77
59 - ```elixir
60 - :telemetry_poller.start_link(
61 - # include custom measurement as an MFA tuple
62 - measurements: [
63 - {:process_info, name: :my_app_worker, event: [:my_app, :worker], keys: [:message, :message_queue_len]},
64 - {ExampleApp.Measurements, :dispatch_session_count, []},
65 - ],
66 - period: :timer.seconds(10), # configure sampling period - default is :timer.seconds(5)
67 - name: :my_app_poller
68 - )
69 - ```
70 -
71 78 ## Documentation
72 79
73 80 See [documentation](https://hexdocs.pm/telemetry_poller/) for more concrete examples and usage
74 81 instructions.
75 82
83 + ## VM metrics example
84 +
85 + ### Erlang
86 +
87 + Find, in `examples/telemetry_poller_vm.erl`, an example on how to retrieve to VM measurements,
88 + mentioned above.
89 +
90 + To see it in action, fire up `rebar3 shell`, then
91 +
92 + ```erlang
93 + {ok, telemetry_poller_vm} = c("examples/telemetry_poller_vm").
94 + ok = file:delete("telemetry_poller_vm.beam"). % Deletes generated BEAM
95 + ok = telemetry_poller_vm:attach().
96 + ```
97 +
98 + ### Elixir
99 +
100 + Find, in `examples/TelemetryPollerVM.ex`, an example on how to retrieve to VM measurements,
101 + mentioned above.
102 +
103 + To see it in action, first compile the Erlang sources with `rebar3 compile`.
104 +
105 + Then fire up `iex -pa "_build/default/lib/*/ebin"`, then
106 +
107 + ```elixir
108 + {:ok, _} = Application.ensure_all_started(:telemetry_poller)
109 +
110 + [TelemetryPollerVM] = c("examples/TelemetryPollerVM.ex")
111 + :ok = TelemetryPollerVM.attach()
112 + ```
113 +
76 114 ## Copyright and License
77 115
78 - telemetry_poller is copyright (c) 2018 Chris McCord and Erlang Solutions.
116 + Copyright (c) 2019 Erlang Ecosystem Foundation and Erlang Solutions.
79 117
80 118 telemetry_poller source code is released under Apache License, Version 2.0.
  @@ -4,10 +4,11 @@
4 4 <<"Periodically collect measurements and dispatch them as Telemetry events.">>}.
5 5 {<<"files">>,
6 6 [<<"CHANGELOG.md">>,<<"LICENSE">>,<<"NOTICE">>,<<"README.md">>,
7 - <<"rebar.config">>,<<"rebar.lock">>,<<"src/telemetry_poller.app.src">>,
8 - <<"src/telemetry_poller.erl">>,<<"src/telemetry_poller_app.erl">>,
9 - <<"src/telemetry_poller_builtin.erl">>,<<"src/telemetry_poller_sup.erl">>]}.
10 - {<<"licenses">>,[<<"Apache 2.0">>]}.
7 + <<"rebar.config">>,<<"rebar.lock">>,<<"src">>,
8 + <<"src/telemetry_poller.app.src">>,<<"src/telemetry_poller.erl">>,
9 + <<"src/telemetry_poller_app.erl">>,<<"src/telemetry_poller_builtin.erl">>,
10 + <<"src/telemetry_poller_sup.erl">>]}.
11 + {<<"licenses">>,[<<"Apache-2.0">>]}.
11 12 {<<"links">>,
12 13 [{<<"GitHub">>,<<"https://github.com/beam-telemetry/telemetry_poller">>}]}.
13 14 {<<"name">>,<<"telemetry_poller">>}.
  @@ -16,4 +17,4 @@
16 17 [{<<"app">>,<<"telemetry">>},
17 18 {<<"optional">>,false},
18 19 {<<"requirement">>,<<"~> 1.0">>}]}]}.
19 - {<<"version">>,<<"1.0.0">>}.
20 + {<<"version">>,<<"1.1.0">>}.
  @@ -9,16 +9,21 @@
9 9 %% create junit xml for circleci
10 10 {ct_opts, [{ct_hooks, [cth_surefire]}]},
11 11 {src_dirs, ["src", "test/support"]}
12 - ]},
13 - {docs, [{edoc_opts, [{preprocess, true},
14 - {doclet, edoc_doclet_chunks},
15 - {layout, edoc_layout_chunks},
16 - {dir, "_build/docs/lib/telemetry_poller/doc"}]}
17 -
18 12 ]}
19 13 ]}.
20 14
21 - {shell, [{apps, [telemetry_poller_app]}]}.
15 + {shell, [{apps, [telemetry_poller]}]}.
16 +
17 + {project_plugins, [rebar3_ex_doc]}.
18 + {ex_doc, [
19 + {main, "README.md"},
20 + {extras, [<<"README.md">>, <<"CHANGELOG.md">>, <<"LICENSE">>, <<"NOTICE">>]},
21 + {source_url, <<"https://github.com/beam-telemetry/telemetry_poller">>},
22 + {source_ref, <<"v1.1.0">>}
23 + ]}.
24 + {hex, [
25 + {doc, #{provider => ex_doc}}
26 + ]}.
22 27
23 28 %% take out warnings for unused exported functions
24 29 {xref_checks,[undefined_function_calls, undefined_functions, locals_not_used,
  @@ -1,12 +1,12 @@
1 1 {application,telemetry_poller,
2 2 [{description,"Periodically collect measurements and dispatch them as Telemetry events."},
3 - {vsn,"1.0.0"},
3 + {vsn,"1.1.0"},
4 4 {registered,[]},
5 5 {mod,{telemetry_poller_app,[]}},
6 6 {applications,[kernel,stdlib,telemetry]},
7 7 {env,[]},
8 8 {modules,[]},
9 - {licenses,["Apache 2.0"]},
9 + {licenses,["Apache-2.0"]},
10 10 {doc,"doc"},
11 11 {links,[{"GitHub",
12 12 "https://github.com/beam-telemetry/telemetry_poller"}]}]}.
Loading more files…