Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 1/5] feedback_daemon: include server uptime in the report
Date: Thu,  8 Apr 2021 16:38:37 +0300	[thread overview]
Message-ID: <3a7e5e50540c9e5df3542e3ebb6167c806bab3da.1617888916.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1617888916.git.sergepetrenko@tarantool.org>

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)


  reply	other threads:[~2021-04-08 13:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 13:38 [Tarantool-patches] [PATCH v2 0/5] send feedback on start and on key events Serge Petrenko via Tarantool-patches
2021-04-08 13:38 ` Serge Petrenko via Tarantool-patches [this message]
2021-04-08 13:38 ` [Tarantool-patches] [PATCH v2 2/5] feedback_daemon: rename `send_test` to `send` Serge Petrenko via Tarantool-patches
2021-04-08 13:38 ` [Tarantool-patches] [PATCH v2 3/5] feedback_daemon: send feedback on server start Serge Petrenko via Tarantool-patches
2021-04-09 21:53   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-10 15:03     ` Serge Petrenko via Tarantool-patches
2021-04-08 13:38 ` [Tarantool-patches] [PATCH v2 4/5] feedback_daemon: generate report right before sending Serge Petrenko via Tarantool-patches
2021-04-09 21:53   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-10 15:03     ` Serge Petrenko via Tarantool-patches
2021-04-08 13:38 ` [Tarantool-patches] [PATCH v2 5/5] feedback_daemon: count and report some events Serge Petrenko via Tarantool-patches
2021-04-13  8:31   ` Alexander Turenko via Tarantool-patches
2021-04-13 10:38     ` Serge Petrenko via Tarantool-patches
2021-04-11 14:15 ` [Tarantool-patches] [PATCH v2 0/5] send feedback on start and on key events Vladislav Shpilevoy via Tarantool-patches
2021-04-12  6:04   ` Kirill Yukhin via Tarantool-patches
2021-04-13  9:44     ` Alexander Turenko via Tarantool-patches
2021-04-12  6:05 ` Kirill Yukhin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a7e5e50540c9e5df3542e3ebb6167c806bab3da.1617888916.git.sergepetrenko@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 1/5] feedback_daemon: include server uptime in the report' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox