Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

Commit 28495f8

Browse files
author
Konstantin Nazarov
committed
Add Tarantool space stats
1 parent e2aec5b commit 28495f8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tarantool-metrics.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ local uptime_seconds = prometheus.gauge(
2424
'tarantool_uptime_seconds',
2525
'Number of seconds since the server started')
2626

27+
local tuples_total = prometheus.gauge(
28+
'tarantool_space_tuples_total',
29+
'Total number of tuples in a space',
30+
{'space_name'})
31+
32+
2733
local function measure_tarantool_memory_usage()
2834
local slabs = box.slab.info()
2935
local memory_limit = slabs.quota_size
@@ -52,10 +58,22 @@ local function measure_tarantool_uptime()
5258
uptime_seconds:set(box.info.uptime)
5359
end
5460

61+
local function measure_tarantool_space_stats()
62+
for _, space in box.space._space:pairs() do
63+
local space_name = space[3]
64+
65+
if string.sub(space_name, 1,1) ~= '_' then
66+
tuples_total:set(box.space[space_name]:len(), {space_name})
67+
end
68+
end
69+
70+
end
71+
5572
local function measure_tarantool_metrics()
5673
measure_tarantool_memory_usage()
5774
measure_tarantool_request_stats()
5875
measure_tarantool_uptime()
76+
measure_tarantool_space_stats()
5977
end
6078

6179
return {measure_tarantool_metrics=measure_tarantool_metrics}

0 commit comments

Comments
 (0)