Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: alyapunov@tarantool.org, v.shpilevoy@tarantool.org, mons@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 2/2] feedback_daemon: send feedback on tarantool exit
Date: Thu, 24 Dec 2020 16:34:51 +0300	[thread overview]
Message-ID: <5912b7266d065501fe33500c640048ac26804f0f.1608816289.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1608816289.git.sergepetrenko@tarantool.org>

Feedback daemon is now able to send feedback once tarantool exits.
This helps to gather statistics for instances that shut down even before
the first feedback_interval passes.
---
 src/box/lua/feedback_daemon.lua | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 1aac32bb3..f42ab5822 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -355,6 +355,13 @@ local function guard_loop(self)
     self.shutdown:put("stopped")
 end
 
+-- An on_shutdown trigger to fire on tarantool exit.
+local function on_shutdown(self)
+    if self.control ~= nil then
+        self.control:put("send")
+    end
+end
+
 -- these functions are used for test purposes only
 local function start(self)
     self:stop()
@@ -400,6 +407,9 @@ setmetatable(daemon, {
         generate_feedback = function()
             return fill_in_feedback({ feedback_version = 5 })
         end,
+        on_shutdown = function()
+            on_shutdown(daemon)
+        end,
         start = function()
             start(daemon)
         end,
@@ -437,3 +447,6 @@ if box.internal == nil then
 else
     box.internal[PREFIX] = daemon
 end
+
+-- Send feedback on Tarantool exit.
+box.ctl.on_shutdown(function() daemon:on_shutdown() end)
-- 
2.24.3 (Apple Git-128)

  parent reply	other threads:[~2020-12-24 13:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 13:34 [Tarantool-patches] [PATCH 0/2] feedback_daemon: add operation statistics reporting and an additional report on shutdown Serge Petrenko
2020-12-24 13:34 ` [Tarantool-patches] [PATCH 1/2] feedback_daemon: add operation statistics reporting Serge Petrenko
2020-12-24 17:54   ` Vladislav Shpilevoy
2020-12-24 21:09     ` Serge Petrenko
2020-12-25  8:13       ` Aleksandr Lyapunov
2020-12-25  8:29   ` Kirill Yukhin
2020-12-24 13:34 ` Serge Petrenko [this message]
2020-12-24 17:54   ` [Tarantool-patches] [PATCH 2/2] feedback_daemon: send feedback on tarantool exit Vladislav Shpilevoy
2020-12-24 21:11     ` Serge Petrenko
2020-12-25  8:12   ` Aleksandr Lyapunov
2020-12-25  8:50     ` Serge Petrenko
2020-12-25 11:23       ` Aleksandr Lyapunov

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=5912b7266d065501fe33500c640048ac26804f0f.1608816289.git.sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=mons@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] feedback_daemon: send feedback on tarantool exit' \
    /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