[Tarantool-patches] [PATCH v2 1/5] feedback_daemon: include server uptime in the report
Serge Petrenko
sergepetrenko at tarantool.org
Thu Apr 8 16:38:37 MSK 2021
We are going to send feedback right after initial `box.cfg{}` call, so
include server uptime in the report to filter out short-living CI
instances.
Also, while we're at it, fix a typo in feedback_daemon test.
Prerequisite #5750
---
src/box/lua/feedback_daemon.lua | 3 ++-
test/box-tap/feedback_daemon.test.lua | 13 +++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index d54d75414..8820bcde5 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -108,6 +108,7 @@ local function fill_in_base_info(feedback)
feedback.tarantool_version = box.info.version
feedback.server_id = box.info.uuid
feedback.cluster_id = box.info.cluster.uuid
+ feedback.uptime = box.info.uptime
end
local function fill_in_platform_info(feedback)
@@ -400,7 +401,7 @@ setmetatable(daemon, {
end,
-- this function is used in saving feedback in file
generate_feedback = function()
- return fill_in_feedback({ feedback_version = 5 })
+ return fill_in_feedback({ feedback_version = 6 })
end,
start = function()
start(daemon)
diff --git a/test/box-tap/feedback_daemon.test.lua b/test/box-tap/feedback_daemon.test.lua
index 8cfbf31d7..e1c450d2b 100755
--- a/test/box-tap/feedback_daemon.test.lua
+++ b/test/box-tap/feedback_daemon.test.lua
@@ -70,7 +70,7 @@ if not ok then
os.exit(0)
end
-test:plan(27)
+test:plan(28)
local function check(message)
while feedback_count < 1 do
@@ -123,9 +123,11 @@ local fio = require("fio")
local fh = fio.open("feedback.json")
test:ok(fh, "file is created")
local file_data = fh:read()
--- Ignore the report time. The data should be equal other than that.
-feedback_save = string.gsub(feedback_save, '"time":(%d+)', 'time:0')
-file_data = string.gsub(file_data, '"time":(%d+)', 'time:0')
+-- Ignore the report time and uptime. The data should be equal other than that.
+feedback_save = string.gsub(feedback_save, '"uptime":(%d+)', '"uptime":0')
+file_data = string.gsub(file_data, '"uptime":(%d+)', '"uptime":0')
+feedback_save = string.gsub(feedback_save, '"time":(%d+)', '"time":0')
+file_data = string.gsub(file_data, '"time":(%d+)', '"time":0')
test:is(file_data, feedback_save, "data is equal")
fh:close()
fio.unlink("feedback.json")
@@ -288,5 +290,8 @@ test:is(fiber.time64(), actual.stats.time, "Time of report generation is correct
check_stats(actual.stats)
+actual = daemon.generate_feedback()
+test:is(box.info.uptime, actual.uptime, "Server uptime is reported and is correct.")
+
test:check()
os.exit(0)
--
2.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list