@@ -9,6 +9,15 @@ dovecotlinks:
99 stats_group_by :
1010 hash : group-by
1111 text : " Statistics: Group By"
12+ stats_group_by_discrete :
13+ hash : discrete
14+ text : " Statistics: Group By: Discrete"
15+ stats_group_by_exponential :
16+ hash : exponential
17+ text : " Statistics: Group By: Exponential"
18+ stats_group_by_linear :
19+ hash : linear
20+ text : " Statistics: Group By: Linear"
1221---
1322
1423# Statistics
@@ -36,34 +45,34 @@ filter setting. You can also use `event=*` to match all named events.
3645
3746## Group By
3847
39- The ` group_by ` metric setting allows dynamic hierarchical metric
48+ The [[ setting,metric_group_by ]] setting allows dynamic hierarchical metric
4049generation based on event fields' values.
4150
42- Each field listed in the ` group_by ` generates one level of "sub-metrics".
51+ Each listed [[ setting,metric_group_by ]] generates one level of "sub-metrics".
4352These automatically generated metrics are indistinguishable from those
4453statically defined in the config file. "sub-metric" names can be up to
4554256 bytes in total.
4655
47- Dovecot supports a number of aggregation functions that can be used to
48- quantize a field's value before it is used to generate a metric.
49-
50- The format is always the same: the field name, a colon, the aggregation
51- function name, and optionally a colon followed by colon delimited parameters
52- to the aggregation function.
56+ Dovecot supports a number of aggregation methods that can be used to quantize
57+ a field's value before it is used to generate a metric.
5358
5459### ` discrete `
5560
56- The simplest aggregation function is to use the value as is. Because this
57- is a very common use case, not specifying an aggregation function is treated
58- as an alias for discrete aggregation. In other words, ` field ` and
59- ` field:discrete ` produce the same behavior.
61+ The simplest aggregation method is to use the value as is. Because this
62+ is a very common use case, this is the default aggregation method.
63+
64+ The value can be further modified by
65+ [[ setting,metric_group_by_method_discrete_modifier]] .
6066
6167Example:
6268
6369``` [dovecot.conf]
6470metric imap_command {
6571 filter = event=imap_command_finished
66- group_by = cmd_name tagged_reply_state
72+ group_by cmd_name {
73+ }
74+ group_by tagged_reply_state {
75+ }
6776}
6877```
6978
@@ -89,21 +98,24 @@ when first observed.
8998
9099The field's integer value is quantized into exponentially sized ranges.
91100
92- The exponential aggregation function takes three colon delimited integer
93- arguments that define the set of ranges used: the minimum magnitude, the
94- maximum magnitude, and the base. The exact configuration syntax is:
95- ` field:exponential:min:max:base `
101+ The exponential aggregation method uses three settings:
96102
97- Note: Currently, only base 2 and base 10 are supported.
103+ * [[ setting,metric_group_by_method_exponential_min_magnitude]]
104+ * [[ setting,metric_group_by_method_exponential_max_magnitude]]
105+ * [[ setting,metric_group_by_method_exponential_base]]
106+ Note: Currently, only base 2 and base 10 are supported.
98107
99- The first range starts at negative infinity and ends at ` pow(base, min) ` .
100- The second range begins at ` pow(base, min) + 1 ` and ends at
101- ` pow(base, min + 1) ` , the next covers ` pow(base, min + 1) + 1 ` to
102- ` pow(base, min + 2) ` , and so on. The last range covers
103- ` pow(base, max) + 1 ` to positive infinity.
108+ The first range starts at negative infinity and ends at
109+ ` pow(base, min_magnitude) ` . The second range begins at
110+ ` pow(base, min_magnitude) + 1 ` and ends at ` pow(base, min_magnitude + 1) ` ,
111+ the next covers ` pow(base, min_magnitude + 1) + 1 ` to
112+ ` pow(base, min_magnitude + 2) ` , and so on. The last range covers
113+ ` pow(base, max_magnitude) + 1 ` to positive infinity.
104114
105- For example, given the specification ` duration:exponential:1:5:10 ` , the
106- ranges would be:
115+ For example, given the settings
116+ [[ setting,metric_group_by_method_exponential_min_magnitude,1]] ,
117+ [[ setting,metric_group_by_method_exponential_max_magnitude,5]] and
118+ [[ setting,metric_group_by_method_exponential_base,10]] , the ranges would be:
107119
108120* (-inf, 10]
109121* [ 11, 100]
@@ -112,8 +124,8 @@ ranges would be:
112124* [ 10001, 100000]
113125* [ 100001, +inf)
114126
115- Much like the metric names generated with the ` discrete ` aggregation
116- function , the ones generated by the ` exponential ` function include
127+ Much like the metric names generated with the [ discrete] ( #discrete ) aggregation
128+ method , the ones generated by the ` exponential ` method include
117129information about the value of the field. However, in this case it is the
118130range the value belongs to.
119131
@@ -125,7 +137,15 @@ Example:
125137``` [dovecot.conf]
126138metric imap_command {
127139 filter = event=imap_command_finished
128- group_by = cmd_name duration:exponential:1:5:10
140+ group_by cmd_name {
141+ }
142+ group_by duration {
143+ method exponential {
144+ min_magnitude = 1
145+ max_magnitude = 5
146+ base = 10
147+ }
148+ }
129149}
130150```
131151
@@ -144,7 +164,7 @@ for a `SELECT` IMAP command, the possible generated metric names are:
144164Note: Since the metric names cannot contain ` - ` , the string ` ninf ` is used
145165to denote negative infinity.
146166
147- Note: Much like in the ` discrete ` case, the metrics are allocated only
167+ Note: Much like in the [ discrete] ( #discrete ) case, the metrics are allocated only
148168when first observed.
149169
150170Finally, because all intermediate level metrics are generated as well. The
@@ -157,18 +177,20 @@ above example, will also generate all of the following metrics:
157177
158178The field's integer value is quantized into linearly sized ranges.
159179
160- The linear aggregation function takes three colon delimited integer
161- arguments that define the set of ranges used: the minimum value, the
162- maximum value, and the range step size. The exact configuration syntax is:
163- ` field:linear:min:max:step `
180+ The linear aggregation method uses three settings:
181+
182+ * [[ setting,metric_group_by_method_linear_min]]
183+ * [[ setting,metric_group_by_method_linear_max]]
184+ * [[ setting,metric_group_by_method_linear_step]]
164185
165186The first range starts at negative infinity and ends at ` min ` . The second
166187range begins at ` min + 1 ` and ends at ` min + step ` , the next covers
167188` min + step + 1 ` to ` min + (2 * step) ` , and so on. The last range
168189covers ` max + 1 ` to positive infinity.
169190
170- For example, given the specification ` net_out_bytes:linear:0:5000:1000 ` , the
171- ranges would be:
191+ For example, given settings [[ setting,metric_group_by_method_linear_min,0]] ,
192+ [[ setting,metric_group_by_method_linear_max,5000]] and
193+ [[ setting,metric_group_by_method_linear_step,1000]] , the ranges would be:
172194
173195* (-inf, 0]
174196* [ 1, 1000]
@@ -178,7 +200,7 @@ ranges would be:
178200* [ 4001, 5000]
179201* [ 5001, +inf)
180202
181- See the description of the [ exponential] ( #exponential ) aggregation function
203+ See the description of the [ exponential] ( #exponential ) aggregation method
182204for how metric names are formed from these ranges.
183205
184206## Listing Statistics
@@ -285,7 +307,8 @@ metric storage_http_gets {
285307# generate per-command metrics on successful commands
286308metric imap_command {
287309 filter = event=imap_command_finished AND tagged_reply_state=OK
288- group_by = cmd_name
310+ group_by cmd_name {
311+ }
289312}
290313```
291314
@@ -364,17 +387,34 @@ metric auth_success {
364387
365388metric imap_command {
366389 filter = event=imap_command_finished
367- group_by = cmd_name tagged_reply_state
390+ group_by cmd_name {
391+ }
392+ group_by tagged_reply_state {
393+ }
368394}
369395
370396metric smtp_command {
371397 filter = event=smtp_server_command_finished
372- group_by = cmd_name status_code duration:exponential:1:5:10
398+ group_by cmd_name {
399+ }
400+ group_by status_code {
401+ }
402+ group_by duration {
403+ method exponential {
404+ min_magnitude = 1
405+ max_magnitude = 5
406+ }
407+ }
373408}
374409
375410metric mail_delivery {
376411 filter = event=mail_delivery_finished
377- group_by = duration:exponential:1:5:10
412+ group_by duration {
413+ method exponential {
414+ min_magnitude = 1
415+ max_magnitude = 5
416+ }
417+ }
378418}
379419```
380420
0 commit comments