@@ -70,12 +70,12 @@ Instance health check
70
70
-------------------------------------------------------------------------------
71
71
72
72
In production environments Tarantool Cluster usually has a large number of so called
73
- "routers", Tarantool instances that handle input load and it is required to evenly
74
- distribute the load. Various load-balancers are used for this, but any load-balancer
75
- have to know which "routers" are ready to accept the load at that very moment. Metrics
76
- library has a special plugin that creates an http handler that can be used by the
77
- load-balancer to check the current state of any Tarantool instance. If the instance
78
- is ready to accept the load, it will return a response with a 200 status code, if not,
73
+ "routers", Tarantool instances that handle input load and it is required to evenly
74
+ distribute the load. Various load-balancers are used for this, but any load-balancer
75
+ have to know which "routers" are ready to accept the load at that very moment. Metrics
76
+ library has a special plugin that creates an http handler that can be used by the
77
+ load-balancer to check the current state of any Tarantool instance. If the instance
78
+ is ready to accept the load, it will return a response with a 200 status code, if not,
79
79
with a 500 status code.
80
80
81
81
.. _cartridge-role :
@@ -117,6 +117,47 @@ via configuration.
117
117
},
118
118
})
119
119
120
+ #. To view metrics via API endpoints, use ``set_export ``.
121
+
122
+ **NOTE ** that ``set_export `` has lower priority than clusterwide config and won't work if metrics config is present.
123
+
124
+ .. code-block :: lua
125
+
126
+ local metrics = require('cartridge.roles.metrics')
127
+ metrics.set_export({
128
+ {
129
+ path = '/path_for_json_metrics',
130
+ format = 'json'
131
+ },
132
+ {
133
+ path = '/path_for_prometheus_metrics',
134
+ format = 'prometheus'
135
+ },
136
+ {
137
+ path = '/health',
138
+ format = 'health'
139
+ }
140
+ })
141
+
142
+ You can add several entry points of the same format by different paths,
143
+ like this:
144
+
145
+ .. code-block :: yaml
146
+
147
+ metrics.set_export({
148
+ {
149
+ path = '/path_for_json_metrics',
150
+ format = 'json'
151
+ },
152
+ {
153
+ path = '/another_path_for_json_metrics',
154
+ format = 'json'
155
+ },
156
+ })
157
+
158
+ The metrics will be available on the path specified in ``path `` in the format
159
+ specified in ``format ``.
160
+
120
161
#. Enable role in the interface:
121
162
122
163
.. image :: images/role-enable.png
@@ -137,9 +178,10 @@ via configuration.
137
178
local cartridge = require('cartridge')
138
179
local metrics = cartridge.service_get('metrics')
139
180
140
- #. To view metrics via API endpoints, use the following configuration
181
+ #. To change metrics HTTP path in ** runtime **, you may use the following configuration
141
182
(to learn more about Cartridge configuration, see
142
- `this <https://www.tarantool.io/en/doc/latest/book/cartridge/topics/clusterwide-config/#managing-role-specific-data >`_):
183
+ `this <https://www.tarantool.io/en/doc/latest/book/cartridge/topics/clusterwide-config/#managing-role-specific-data >`_).
184
+ We don't recommend to use it to set up metrics role, use ``set_export `` instead.
143
185
144
186
.. code-block :: yaml
145
187
@@ -155,40 +197,3 @@ via configuration.
155
197
.. image :: images/role-config.png
156
198
:align: center
157
199
158
- **OR **
159
-
160
- Use ``set_export ``:
161
-
162
- **NOTE ** that ``set_export `` has lower priority than clusterwide config and won't work if metrics config is present.
163
-
164
- .. code-block :: lua
165
-
166
- metrics.set_export({
167
- {
168
- path = '/path_for_json_metrics',
169
- format = 'json'
170
- },
171
- {
172
- path = '/path_for_prometheus_metrics',
173
- format = 'prometheus'
174
- },
175
- {
176
- path = '/health',
177
- format = 'health'
178
- }
179
- })
180
-
181
- The metrics will be available on the path specified in ``path `` in the format
182
- specified in ``format ``.
183
-
184
- You can add several entry points of the same format by different paths,
185
- like this:
186
-
187
- .. code-block :: yaml
188
-
189
- metrics :
190
- export :
191
- - path : ' /path_for_json_metrics'
192
- format : ' json'
193
- - path : ' /another_path_for_json_metrics'
194
- format : ' json'
0 commit comments