@@ -27,7 +27,7 @@ Counter
2727
2828.. module :: metrics
2929
30- .. function :: counter(name [, help])``
30+ .. function :: counter(name [, help])
3131
3232 Registers a new counter.
3333
@@ -37,12 +37,13 @@ Counter
3737 :rtype: counter_obj
3838
3939.. class :: counter_obj
40+
4041 .. method :: inc(num, label_pairs)
4142
4243 Increments an observation under ``label_pairs ``.
4344 If ``label_pairs `` didn't exist before, this creates it.
4445
45- :param number num: Increase value.
46+ :param number num: Increase value.
4647 :param table label_pairs: Table containing label names as keys,
4748 label values as values.
4849
@@ -60,6 +61,7 @@ Counter
6061 value: number, -- current value
6162 metric_name: string, -- collector
6263 }
64+
6365 :rtype: table
6466
6567.. _gauge :
@@ -70,26 +72,33 @@ Gauge
7072
7173.. module :: metrics
7274
73- .. function :: gauge(name [, help])``
75+ .. function :: gauge(name [, help])
7476
7577 Registers a new gauge. Returns a Counter object.
7678
7779 :param string name: Collector name. Must be unique.
7880 :param string help: Help description.
81+
7982 :return: Gauge object
83+
8084 :rtype: gauge_obj
8185
8286.. class :: gauge_obj
87+
8388 .. method :: inc(num, label_pairs)
89+
8490 Same as Counter ``inc() ``.
8591
8692 .. method :: inc(num, label_pairs)
93+
8794 Same as ``inc() ``, but decreases the observation.
8895
8996 .. method :: set(num, label_pairs)
97+
9098 Same as ``inc() ``, but sets the observation.
9199
92100 .. method :: collect()
101+
93102 Returns an array of ``observation `` objects for the given gauge.
94103 For ``observation `` description, see
95104 :ref: `counter_obj:collect() <counter-collect >`.
@@ -106,12 +115,14 @@ Histogram
106115
107116 Registers a new histogram.
108117
109- :param string name: Collector name. Must be unique.
110- :param string help: Help description.
118+ :param string name: Collector name. Must be unique.
119+ :param string help: Help description.
111120 :param table buckets: Histogram buckets (an array of sorted positive numbers).
112121 Infinity bucket (``INF ``) is appended automatically.
113122 Default is ``{.005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, INF} ``.
114- :return: Histogram object.
123+
124+ :return: Histogram object
125+
115126 :rtype: histogram_obj
116127
117128 .. NOTE ::
@@ -134,13 +145,14 @@ Histogram
134145 This increments all buckets sizes under labels ``le`` >= ``num``
135146 and labels matching ``label_pairs``.
136147
137- :param number num: Value to put in the histogram.
148+ :param number num: Value to put in the histogram.
138149 :param table label_pairs: Table containing label names as keys,
139150 label values as values (table).
140151 A new value is observed by all internal counters
141152 with these labels specified.
142153
143154 .. method: collect()
155+
144156 Returns a concatenation of ``counter_obj:collect()`` across all internal
145157 counters of ``histogram_obj``. For ``observation`` description,
146158 see :ref:`counter_obj:collect() <counter-collect>`.
@@ -198,8 +210,10 @@ You can also set global labels by calling
198210.. module :: metrics
199211
200212.. function :: enable_default_metrics()
213+
201214 Enables default metrics collections.
202- Collects Tarantool metrics ported from https://github.com/tarantool/stat .
215+ Collects Tarantool metrics ported from https://github.com/tarantool/stat
216+
203217 Default metrics are:
204218
205219 * ``fiber_count `` - Amount of fibers
@@ -233,13 +247,17 @@ You can also set global labels by calling
233247 * ``cfg_current_time `` - Tarantool cfg time
234248
235249.. function :: metrics.set_global_labels(label_pairs)
250+
236251 Set global labels that will be added to every observation.
237252
238253 :param table label_pairs: Table containing label names as string keys,
239254 label values as values (table).
240255
241256 Global labels are applied only on metrics collection and have no effect
242- on how observations are stored. Global labels can be changed on the fly.
257+ on how observations are stored.
258+
259+ Global labels can be changed on the fly.
260+
243261 Observation ``label_pairs `` has priority over global labels:
244262 if you pass ``label_pairs `` to an observation method with the same key as
245263 some global label, the method argument value will be used.
@@ -270,8 +288,8 @@ latency statistics.
270288 Registers a collector for the middleware and sets it as default.
271289
272290 :param string type_name: Collector type: "histogram" or "average". Default is "histogram".
273- :param string name: Collector name. Default is "http_server_request_latency".
274- :param string help: Help description. Default is "HTTP Server Request Latency".
291+ :param string name: Collector name. Default is "http_server_request_latency".
292+ :param string help: Help description. Default is "HTTP Server Request Latency".
275293
276294 If a collector with the same type and name already exists in the registry,
277295 throws an error.
@@ -281,8 +299,8 @@ latency statistics.
281299 Registers a collector for the middleware and returns it.
282300
283301 :param string type_name: Collector type: "histogram" or "average". Default is "histogram".
284- :param string name: Collector name. Default is "http_server_request_latency".
285- :param string help: Help description. Default is "HTTP Server Request Latency".
302+ :param string name: Collector name. Default is "http_server_request_latency".
303+ :param string help: Help description. Default is "HTTP Server Request Latency".
286304
287305 If a collector with the same type and name already exists in the registry,
288306 throws an error.
0 commit comments