Skip to content

Commit c6779e5

Browse files
authored
Fix markup in docs (#98)
1 parent e897735 commit c6779e5

File tree

3 files changed

+77
-58
lines changed

3 files changed

+77
-58
lines changed

doc/monitoring/api_reference.rst

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

doc/monitoring/getting_started.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ via configuration.
100100
metrics package, you may get it as a Cartridge service and use it like
101101
a regular package after ``require``:
102102

103-
.. code-block:: lua
103+
.. code-block:: lua
104104
105-
local cartridge = require('cartridge')
106-
local metrics = cartridge.service_get('metrics')
105+
local cartridge = require('cartridge')
106+
local metrics = cartridge.service_get('metrics')
107107
108108
#. To view metrics via API endpoints, use the following configuration
109109
(to learn more about Cartridge configuration, see

doc/monitoring/plugins.rst

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,21 @@ Import the JSON plugin:
154154

155155
.. function:: export()
156156

157-
:return:
158-
159-
.. code-block:: json
160-
[
161-
{
162-
"name":<name>,
163-
"label_pairs": {
164-
<name>:<value>,
165-
...
166-
},
167-
"timestamp":<number>,
168-
"value":<value>
169-
},
170-
...
171-
]
157+
:return: the following structure
158+
159+
.. code-block:: json
160+
[
161+
{
162+
"name":<name>,
163+
"label_pairs": {
164+
<name>:<value>,
165+
...
166+
},
167+
"timestamp":<number>,
168+
"value":<value>
169+
},
170+
...
171+
]
172172
173173
:rtype: string
174174

@@ -239,48 +239,49 @@ We encourage you to use the following methods **only when developing a new plugi
239239

240240
.. module:: metrics
241241

242-
.. function:: invoke_callbacks()
242+
.. function:: invoke_callbacks()
243243

244-
Invokes the function registered via
245-
``metrics.register_callback(<callback>)``.
246-
Used in exporters.
244+
Invokes the function registered via
245+
``metrics.register_callback(<callback>)``.
246+
Used in exporters.
247247

248-
.. function:: collectors()
248+
.. function:: collectors()
249249

250-
Designed to be used in exporters in favor of ``metrics.collect()``.
250+
Designed to be used in exporters in favor of ``metrics.collect()``.
251251

252-
:return: a list of created collectors.
252+
:return: a list of created collectors
253253

254-
.. class:: collector_object
255-
.. method:: collect()
254+
.. class:: collector_object
256255

257-
.. NOTE::
256+
.. method:: collect()
258257

259-
You'll probably want to use ``metrics.collectors()`` instead.
258+
.. NOTE::
260259

261-
Equivalent to:
260+
You'll probably want to use ``metrics.collectors()`` instead.
262261

263-
.. code-block:: lua
262+
Equivalent to:
264263

265-
for _, c in pairs(metrics.collectors()) do
266-
for _, obs in ipairs(c:collect()) do
267-
... -- handle observation
268-
end
264+
.. code-block:: lua
265+
266+
for _, c in pairs(metrics.collectors()) do
267+
for _, obs in ipairs(c:collect()) do
268+
... -- handle observation
269269
end
270+
end
270271
271-
:return: Concatenation of ``observation`` objects across all
272-
created collectors.
272+
:return: Concatenation of ``observation`` objects across all
273+
created collectors.
273274

274-
.. code-block:: lua
275+
.. code-block:: lua
275276
276-
{
277-
label_pairs: table, -- `label_pairs` key-value table
278-
timestamp: ctype<uint64_t>, -- current system time (in microseconds)
279-
value: number, -- current value
280-
metric_name: string, -- collector
281-
}
277+
{
278+
label_pairs: table, -- `label_pairs` key-value table
279+
timestamp: ctype<uint64_t>, -- current system time (in microseconds)
280+
value: number, -- current value
281+
metric_name: string, -- collector
282+
}
282283
283-
:rtype: table
284+
:rtype: table
284285

285286
.. _writing-custom-plugins:
286287

0 commit comments

Comments
 (0)