From 0af589d072ce24d0733ac979a5050efe5315c375 Mon Sep 17 00:00:00 2001 From: Igor Zolotarev <63460867+yngvar-antonsson@users.noreply.github.com> Date: Fri, 30 Jul 2021 20:32:47 +0300 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Yaroslav Dynnikov --- metrics/default_metrics/tarantool/init.lua | 4 ++++ metrics/default_metrics/tarantool/memory.lua | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/metrics/default_metrics/tarantool/init.lua b/metrics/default_metrics/tarantool/init.lua index 88f75933..285c62e6 100644 --- a/metrics/default_metrics/tarantool/init.lua +++ b/metrics/default_metrics/tarantool/init.lua @@ -19,9 +19,13 @@ local default_metrics = { } local function delete_collectors(list) + if list == nil then + return + end for _, collector in pairs(list) do metrics.registry:unregister(collector) end + table.clear(list) end local function enable(include, exclude) diff --git a/metrics/default_metrics/tarantool/memory.lua b/metrics/default_metrics/tarantool/memory.lua index 9410f734..2eade57a 100644 --- a/metrics/default_metrics/tarantool/memory.lua +++ b/metrics/default_metrics/tarantool/memory.lua @@ -11,7 +11,7 @@ local function update_memory_metrics() local i = box.info.memory() for k, v in pairs(i) do local metric_name = 'info_memory_' .. k - collectors_list[metric_name] = utils.set_gauge(metric_name, 'Memory' .. k, v) + collectors_list[metric_name] = utils.set_gauge(metric_name, 'Memory ' .. k, v) end end end