@@ -20,6 +20,9 @@ local metric_name = {
20
20
-- Counter collector for spaces not found.
21
21
space_not_found = ' tnt_crud_space_not_found' ,
22
22
23
+ -- Counter collector for schema reloads.
24
+ schema_reloads = ' tnt_crud_schema_reloads' ,
25
+
23
26
-- Counter collectors for select/pairs details.
24
27
details = {
25
28
tuples_fetched = ' tnt_crud_tuples_fetched' ,
@@ -110,6 +113,10 @@ function registry.init(opts)
110
113
metric_name .space_not_found ,
111
114
' Spaces not found during CRUD calls' )
112
115
116
+ internal .registry [metric_name .schema_reloads ] = metrics .counter (
117
+ metric_name .schema_reloads ,
118
+ ' Schema reloads performed in operation calls' )
119
+
113
120
internal .registry [metric_name .details .tuples_fetched ] = metrics .counter (
114
121
metric_name .details .tuples_fetched ,
115
122
' Tuples fetched from CRUD storages during select/pairs' )
@@ -210,6 +217,7 @@ function registry.get(space_name)
210
217
local stats = {
211
218
spaces = {},
212
219
space_not_found = 0 ,
220
+ schema_reloads = 0 ,
213
221
}
214
222
215
223
-- Fill operation basic statistics values.
@@ -264,9 +272,14 @@ function registry.get(space_name)
264
272
return stats .spaces [space_name ] or {}
265
273
end
266
274
267
- local _ , obs = next (internal .registry [metric_name .space_not_found ]:collect ())
268
- if obs ~= nil then
269
- stats .space_not_found = obs .value
275
+ local _ , not_found_obs = next (internal .registry [metric_name .space_not_found ]:collect ())
276
+ if not_found_obs ~= nil then
277
+ stats .space_not_found = not_found_obs .value
278
+ end
279
+
280
+ local _ , reload_obs = next (internal .registry [metric_name .schema_reloads ]:collect ())
281
+ if reload_obs ~= nil then
282
+ stats .schema_reloads = reload_obs .value
270
283
end
271
284
272
285
return stats
@@ -396,6 +409,23 @@ function registry.observe_map_reduces(count, space_name)
396
409
return true
397
410
end
398
411
412
+ --- Increase statistics of schema reloads
413
+ --
414
+ -- @function observe_schema_reloads
415
+ --
416
+ -- @tparam number count
417
+ -- Schema reloads performed.
418
+ --
419
+ -- @treturn boolean Returns true.
420
+ --
421
+ function registry .observe_schema_reloads (count )
422
+ dev_checks (' number' )
423
+
424
+ internal .registry [metric_name .schema_reloads ]:inc (count )
425
+
426
+ return true
427
+ end
428
+
399
429
-- Workaround for https://github.com/tarantool/metrics/issues/334 .
400
430
-- This workaround does not prevent observations reset between role reloads,
401
431
-- but it fixes collector unlink from registry. Without this workaround,
0 commit comments