Skip to content

Commit 3245220

Browse files
committed
Bump to v4.8.1
1 parent a00385c commit 3245220

File tree

8 files changed

+309
-10
lines changed

8 files changed

+309
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Copyright (c) 2016,2017 Ilya Khaprov <<[email protected]>>.
66

7-
__Version:__ 4.8.0
7+
__Version:__ 4.8.1
88

99
[![Hex.pm](https://img.shields.io/hexpm/v/prometheus.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/prometheus)
1010
[![Hex.pm](https://img.shields.io/hexpm/dt/prometheus.svg?maxAge=2592000)](https://hex.pm/packages/prometheus)
@@ -284,6 +284,7 @@ MIT
284284
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_mnesia_collector.md" class="module">prometheus_mnesia_collector</a></td></tr>
285285
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_model_helpers.md" class="module">prometheus_model_helpers</a></td></tr>
286286
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_protobuf_format.md" class="module">prometheus_protobuf_format</a></td></tr>
287+
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_quantile_summary.md" class="module">prometheus_quantile_summary</a></td></tr>
287288
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_registry.md" class="module">prometheus_registry</a></td></tr>
288289
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_summary.md" class="module">prometheus_summary</a></td></tr>
289290
<tr><td><a href="https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_text_format.md" class="module">prometheus_text_format</a></td></tr>

doc/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Copyright (c) 2016,2017 Ilya Khaprov <<[email protected]>>.
66

7-
__Version:__ 4.8.0
7+
__Version:__ 4.8.1
88

99
[![Hex.pm](https://img.shields.io/hexpm/v/prometheus.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/prometheus)
1010
[![Hex.pm](https://img.shields.io/hexpm/dt/prometheus.svg?maxAge=2592000)](https://hex.pm/packages/prometheus)
@@ -284,6 +284,7 @@ MIT
284284
<tr><td><a href="prometheus_mnesia_collector.md" class="module">prometheus_mnesia_collector</a></td></tr>
285285
<tr><td><a href="prometheus_model_helpers.md" class="module">prometheus_model_helpers</a></td></tr>
286286
<tr><td><a href="prometheus_protobuf_format.md" class="module">prometheus_protobuf_format</a></td></tr>
287+
<tr><td><a href="prometheus_quantile_summary.md" class="module">prometheus_quantile_summary</a></td></tr>
287288
<tr><td><a href="prometheus_registry.md" class="module">prometheus_registry</a></td></tr>
288289
<tr><td><a href="prometheus_summary.md" class="module">prometheus_summary</a></td></tr>
289290
<tr><td><a href="prometheus_text_format.md" class="module">prometheus_text_format</a></td></tr>

doc/edoc-info

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
prometheus_counter,prometheus_format,prometheus_gauge,
55
prometheus_histogram,prometheus_http,prometheus_mnesia,
66
prometheus_mnesia_collector,prometheus_model_helpers,
7-
prometheus_protobuf_format,prometheus_registry,prometheus_summary,
8-
prometheus_text_format,prometheus_time,prometheus_vm_dist_collector,
7+
prometheus_protobuf_format,prometheus_quantile_summary,
8+
prometheus_registry,prometheus_summary,prometheus_text_format,
9+
prometheus_time,prometheus_vm_dist_collector,
910
prometheus_vm_memory_collector,prometheus_vm_msacc_collector,
1011
prometheus_vm_statistics_collector,
1112
prometheus_vm_system_info_collector]}.

doc/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@copyright 2016,2017 Ilya Khaprov <<[email protected]>>.
22
@title Prometheus.io client for Erlang
3-
@version 4.8.0
3+
@version 4.8.1
44

55
@doc
66
[![Hex.pm](https://img.shields.io/hexpm/v/prometheus.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/prometheus)

doc/prometheus_model_helpers.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Creates <code>prometheus_model:</code>LabelPair'()' from {Name, Value} tuple.</t
196196
<a href="#label_pair-1"><code>lists:map(fun label_pair/1, Labels)</code></a>.</td></tr><tr><td valign="top"><a href="#metric_name-1">metric_name/1</a></td><td>
197197
If <code>Name</code> is a list, looks for atoms and converts them to binaries.</td></tr><tr><td valign="top"><a href="#summary_metric-1">summary_metric/1</a></td><td>
198198
Equivalent to
199-
<a href="#summary_metric-3"><tt>summary_metric(Labels, Count, Sum)</tt></a>.</td></tr><tr><td valign="top"><a href="#summary_metric-2">summary_metric/2</a></td><td>Equivalent to <a href="#summary_metric-3"><tt>summary_metric([], Count, Sum)</tt></a>.</td></tr><tr><td valign="top"><a href="#summary_metric-3">summary_metric/3</a></td><td>
199+
<a href="#summary_metric-3"><tt>summary_metric(Labels, Count, Sum)</tt></a>.</td></tr><tr><td valign="top"><a href="#summary_metric-2">summary_metric/2</a></td><td>Equivalent to <a href="#summary_metric-3"><tt>summary_metric([], Count, Sum)</tt></a>.</td></tr><tr><td valign="top"><a href="#summary_metric-3">summary_metric/3</a></td><td>Equivalent to <a href="#summary_metric-4"><tt>summary_metric([], Count, Sum, [])</tt></a>.</td></tr><tr><td valign="top"><a href="#summary_metric-4">summary_metric/4</a></td><td>
200200
Creates summary metric with <code>Labels</code>, <code>Count</code> and <code>Sum</code>.</td></tr><tr><td valign="top"><a href="#summary_metrics-1">summary_metrics/1</a></td><td>Equivalent to
201201
<a href="#summary_metric-1"><code>lists:map(fun summary_metric/1, Specs)</code></a>.</td></tr><tr><td valign="top"><a href="#untyped_metric-1">untyped_metric/1</a></td><td>
202202
Equivalent to
@@ -440,11 +440,19 @@ Equivalent to [`summary_metric([], Count, Sum)`](#summary_metric-3).
440440

441441
### summary_metric/3 ###
442442

443+
`summary_metric(Labels, Count, Sum) -> any()`
444+
445+
Equivalent to [`summary_metric([], Count, Sum, [])`](#summary_metric-4).
446+
447+
<a name="summary_metric-4"></a>
448+
449+
### summary_metric/4 ###
450+
443451
<pre><code>
444-
summary_metric(Labels, Count, Sum) -&gt; <a href="prometheus_model.md#type-Metric">prometheus_model:'Metric'()</a>
452+
summary_metric(Labels, Count, Sum, Quantiles) -&gt; <a href="prometheus_model.md#type-Metric">prometheus_model:'Metric'()</a>
445453
</code></pre>
446454

447-
<ul class="definitions"><li><code>Labels = <a href="#type-labels">labels()</a></code></li><li><code>Count = non_neg_integer()</code></li><li><code>Sum = <a href="#type-value">value()</a></code></li></ul>
455+
<ul class="definitions"><li><code>Labels = <a href="#type-labels">labels()</a></code></li><li><code>Count = non_neg_integer()</code></li><li><code>Sum = <a href="#type-value">value()</a></code></li><li><code>Quantiles = list()</code></li></ul>
448456

449457
Creates summary metric with `Labels`, `Count` and `Sum`.
450458

doc/prometheus_quantile_summary.md

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
2+
3+
# Module prometheus_quantile_summary #
4+
* [Description](#description)
5+
* [Function Index](#index)
6+
* [Function Details](#functions)
7+
8+
Summary metric, to track the size of events and report quantiles
9+
Based on prometheus_summary.
10+
11+
__Behaviours:__ [`prometheus_collector`](prometheus_collector.md), [`prometheus_metric`](prometheus_metric.md).
12+
13+
<a name="description"></a>
14+
15+
## Description ##
16+
17+
Example use cases for Summaries:
18+
- Response latency;
19+
- Request size;
20+
- Response size.
21+
22+
Example:
23+
24+
```erlang
25+
26+
-module(my_proxy_instrumenter).
27+
setup() ->
28+
prometheus_quantile_summary:declare([{name, request_size_bytes},
29+
{help, "Request size in bytes."}]),
30+
prometheus_quantile_summary:declare([{name, response_size_bytes},
31+
{help, "Response size in bytes."}]).
32+
observe_request(Size) ->
33+
prometheus_quantile_summary:observe(request_size_bytes, Size).
34+
observe_response(Size) ->
35+
prometheus_quantile_summary:observe(response_size_bytes, Size).
36+
```
37+
38+
Reports:
39+
request_size_bytes_size
40+
request_size_bytes_count
41+
request_size_bytes{quantile="0.5"}
42+
request_size_bytes{quantile="0.9"}
43+
request_size_bytes{quantile="0.95"}<a name="index"></a>
44+
45+
## Function Index ##
46+
47+
48+
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#declare-1">declare/1</a></td><td>Creates a summary using <code>Spec</code>.</td></tr><tr><td valign="top"><a href="#deregister-1">deregister/1</a></td><td>Equivalent to <a href="#deregister-2"><tt>deregister(default, Name)</tt></a>.</td></tr><tr><td valign="top"><a href="#deregister-2">deregister/2</a></td><td>
49+
Removes all summary series with name <code>Name</code> and
50+
removes Metric Family from <code>Registry</code>.</td></tr><tr><td valign="top"><a href="#new-1">new/1</a></td><td>Creates a summary using <code>Spec</code>.</td></tr><tr><td valign="top"><a href="#observe-2">observe/2</a></td><td>Equivalent to <a href="#observe-4"><tt>observe(default, Name, [], Value)</tt></a>.</td></tr><tr><td valign="top"><a href="#observe-3">observe/3</a></td><td>Equivalent to <a href="#observe-4"><tt>observe(default, Name, LabelValues, Value)</tt></a>.</td></tr><tr><td valign="top"><a href="#observe-4">observe/4</a></td><td>Observes the given <code>Value</code>.</td></tr><tr><td valign="top"><a href="#observe_duration-2">observe_duration/2</a></td><td>Equivalent to <a href="#observe_duration-4"><tt>observe_duration(default, Name, [], Fun)</tt></a>.</td></tr><tr><td valign="top"><a href="#observe_duration-3">observe_duration/3</a></td><td>Equivalent to <a href="#observe_duration-4"><tt>observe_duration(default, Name, LabelValues, Fun)</tt></a>.</td></tr><tr><td valign="top"><a href="#observe_duration-4">observe_duration/4</a></td><td>Tracks the amount of time spent executing <code>Fun</code>.</td></tr><tr><td valign="top"><a href="#remove-1">remove/1</a></td><td>Equivalent to <a href="#remove-3"><tt>remove(default, Name, [])</tt></a>.</td></tr><tr><td valign="top"><a href="#remove-2">remove/2</a></td><td>Equivalent to <a href="#remove-3"><tt>remove(default, Name, LabelValues)</tt></a>.</td></tr><tr><td valign="top"><a href="#remove-3">remove/3</a></td><td>Removes summary series identified by <code>Registry</code>, <code>Name</code>
51+
and <code>LabelValues</code>.</td></tr><tr><td valign="top"><a href="#reset-1">reset/1</a></td><td>Equivalent to <a href="#reset-3"><tt>reset(default, Name, [])</tt></a>.</td></tr><tr><td valign="top"><a href="#reset-2">reset/2</a></td><td>Equivalent to <a href="#reset-3"><tt>reset(default, Name, LabelValues)</tt></a>.</td></tr><tr><td valign="top"><a href="#reset-3">reset/3</a></td><td>Resets the value of the summary identified by <code>Registry</code>, <code>Name</code>
52+
and <code>LabelValues</code>.</td></tr><tr><td valign="top"><a href="#value-1">value/1</a></td><td>Equivalent to <a href="#value-3"><tt>value(default, Name, [])</tt></a>.</td></tr><tr><td valign="top"><a href="#value-2">value/2</a></td><td>Equivalent to <a href="#value-3"><tt>value(default, Name, LabelValues)</tt></a>.</td></tr><tr><td valign="top"><a href="#value-3">value/3</a></td><td>Returns the value of the summary identified by <code>Registry</code>, <code>Name</code>
53+
and <code>LabelValues</code>.</td></tr><tr><td valign="top"><a href="#values-2">values/2</a></td><td></td></tr></table>
54+
55+
56+
<a name="functions"></a>
57+
58+
## Function Details ##
59+
60+
<a name="declare-1"></a>
61+
62+
### declare/1 ###
63+
64+
`declare(Spec) -> any()`
65+
66+
Creates a summary using `Spec`.
67+
If a summary with the same `Spec` exists returns `false`.
68+
69+
Raises `{missing_metric_spec_key, Key, Spec}` error if required `Soec` key
70+
is missing.<br />
71+
Raises `{invalid_metric_name, Name, Message}` error if metric `Name`
72+
is invalid.<br />
73+
Raises `{invalid_metric_help, Help, Message}` error if metric `Help`
74+
is invalid.<br />
75+
Raises `{invalid_metric_labels, Labels, Message}` error if `Labels`
76+
isn't a list.<br />
77+
Raises `{invalid_label_name, Name, Message}` error if `Name` isn't a valid
78+
label name.<br />
79+
Raises `{invalid_value_error, Value, MessagE}` error if `duration_unit` is
80+
unknown or doesn't match metric name.<br />
81+
82+
<a name="deregister-1"></a>
83+
84+
### deregister/1 ###
85+
86+
`deregister(Name) -> any()`
87+
88+
Equivalent to [`deregister(default, Name)`](#deregister-2).
89+
90+
<a name="deregister-2"></a>
91+
92+
### deregister/2 ###
93+
94+
`deregister(Registry, Name) -> any()`
95+
96+
Removes all summary series with name `Name` and
97+
removes Metric Family from `Registry`.
98+
99+
After this call new/1 for `Name` and `Registry` will succeed.
100+
101+
Returns `{true, _}` if `Name` was a registered summary.
102+
Otherwise returns `{false, _}`.
103+
104+
<a name="new-1"></a>
105+
106+
### new/1 ###
107+
108+
`new(Spec) -> any()`
109+
110+
Creates a summary using `Spec`.
111+
112+
Raises `{missing_metric_spec_key, Key, Spec}` error if required `Soec` key
113+
is missing.<br />
114+
Raises `{invalid_metric_name, Name, Message}` error if metric `Name`
115+
is invalid.<br />
116+
Raises `{invalid_metric_help, Help, Message}` error if metric `Help`
117+
is invalid.<br />
118+
Raises `{invalid_metric_labels, Labels, Message}` error if `Labels`
119+
isn't a list.<br />
120+
Raises `{invalid_label_name, Name, Message}` error if `Name` isn't a valid
121+
label name.<br />
122+
Raises `{invalid_value_error, Value, Message}` error if `duration_unit` is
123+
unknown or doesn't match metric name.<br />
124+
Raises `{mf_already_exists, {Registry, Name}, Message}` error if a summary
125+
with the same `Spec` already exists.
126+
127+
<a name="observe-2"></a>
128+
129+
### observe/2 ###
130+
131+
`observe(Name, Value) -> any()`
132+
133+
Equivalent to [`observe(default, Name, [], Value)`](#observe-4).
134+
135+
<a name="observe-3"></a>
136+
137+
### observe/3 ###
138+
139+
`observe(Name, LabelValues, Value) -> any()`
140+
141+
Equivalent to [`observe(default, Name, LabelValues, Value)`](#observe-4).
142+
143+
<a name="observe-4"></a>
144+
145+
### observe/4 ###
146+
147+
`observe(Registry, Name, LabelValues, Value) -> any()`
148+
149+
Observes the given `Value`.
150+
151+
Raises `{invalid_value, Value, Message}` if `Value`
152+
isn't an integer.<br />
153+
Raises `{unknown_metric, Registry, Name}` error if summary with named `Name`
154+
can't be found in `Registry`.<br />
155+
Raises `{invalid_metric_arity, Present, Expected}` error if labels count
156+
mismatch.
157+
158+
<a name="observe_duration-2"></a>
159+
160+
### observe_duration/2 ###
161+
162+
`observe_duration(Name, Fun) -> any()`
163+
164+
Equivalent to [`observe_duration(default, Name, [], Fun)`](#observe_duration-4).
165+
166+
<a name="observe_duration-3"></a>
167+
168+
### observe_duration/3 ###
169+
170+
`observe_duration(Name, LabelValues, Fun) -> any()`
171+
172+
Equivalent to [`observe_duration(default, Name, LabelValues, Fun)`](#observe_duration-4).
173+
174+
<a name="observe_duration-4"></a>
175+
176+
### observe_duration/4 ###
177+
178+
`observe_duration(Registry, Name, LabelValues, Fun) -> any()`
179+
180+
Tracks the amount of time spent executing `Fun`.
181+
182+
Raises `{unknown_metric, Registry, Name}` error if summary with named `Name`
183+
can't be found in `Registry`.<br />
184+
Raises `{invalid_metric_arity, Present, Expected}` error if labels count
185+
mismatch.
186+
Raises `{invalid_value, Value, Message}` if `Fun`
187+
isn't a function.<br />
188+
189+
<a name="remove-1"></a>
190+
191+
### remove/1 ###
192+
193+
`remove(Name) -> any()`
194+
195+
Equivalent to [`remove(default, Name, [])`](#remove-3).
196+
197+
<a name="remove-2"></a>
198+
199+
### remove/2 ###
200+
201+
`remove(Name, LabelValues) -> any()`
202+
203+
Equivalent to [`remove(default, Name, LabelValues)`](#remove-3).
204+
205+
<a name="remove-3"></a>
206+
207+
### remove/3 ###
208+
209+
`remove(Registry, Name, LabelValues) -> any()`
210+
211+
Removes summary series identified by `Registry`, `Name`
212+
and `LabelValues`.
213+
214+
Raises `{unknown_metric, Registry, Name}` error if summary with name `Name`
215+
can't be found in `Registry`.<br />
216+
Raises `{invalid_metric_arity, Present, Expected}` error if labels count
217+
mismatch.
218+
219+
<a name="reset-1"></a>
220+
221+
### reset/1 ###
222+
223+
`reset(Name) -> any()`
224+
225+
Equivalent to [`reset(default, Name, [])`](#reset-3).
226+
227+
<a name="reset-2"></a>
228+
229+
### reset/2 ###
230+
231+
`reset(Name, LabelValues) -> any()`
232+
233+
Equivalent to [`reset(default, Name, LabelValues)`](#reset-3).
234+
235+
<a name="reset-3"></a>
236+
237+
### reset/3 ###
238+
239+
`reset(Registry, Name, LabelValues) -> any()`
240+
241+
Resets the value of the summary identified by `Registry`, `Name`
242+
and `LabelValues`.
243+
244+
Raises `{unknown_metric, Registry, Name}` error if summary with name `Name`
245+
can't be found in `Registry`.<br />
246+
Raises `{invalid_metric_arity, Present, Expected}` error if labels count
247+
mismatch.
248+
249+
<a name="value-1"></a>
250+
251+
### value/1 ###
252+
253+
`value(Name) -> any()`
254+
255+
Equivalent to [`value(default, Name, [])`](#value-3).
256+
257+
<a name="value-2"></a>
258+
259+
### value/2 ###
260+
261+
`value(Name, LabelValues) -> any()`
262+
263+
Equivalent to [`value(default, Name, LabelValues)`](#value-3).
264+
265+
<a name="value-3"></a>
266+
267+
### value/3 ###
268+
269+
`value(Registry, Name, LabelValues) -> any()`
270+
271+
Returns the value of the summary identified by `Registry`, `Name`
272+
and `LabelValues`. If there is no summary for `LabelValues`,
273+
returns `undefined`.
274+
275+
If duration unit set, sum will be converted to the duration unit.
276+
[Read more here.](prometheus_time.md)
277+
278+
Raises `{unknown_metric, Registry, Name}` error if summary named `Name`
279+
can't be found in `Registry`.<br />
280+
Raises `{invalid_metric_arity, Present, Expected}` error if labels count
281+
mismatch.
282+
283+
<a name="values-2"></a>
284+
285+
### values/2 ###
286+
287+
`values(Registry, Name) -> any()`
288+

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Prometheus.Mixfile do
33

44
def project do
55
[app: :prometheus,
6-
version: "4.8.0",
6+
version: "4.8.1",
77
description: description(),
88
package: package(),
99
deps: deps()]

src/prometheus.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, prometheus,
22
[{description, "Prometheus.io client in Erlang"},
3-
{vsn, "4.8.0"},
3+
{vsn, "4.8.1"},
44
{registered, []},
55
{mod, { prometheus, []}},
66
{applications,

0 commit comments

Comments
 (0)