summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2017-06-13 14:40:09 +0530
committerAravinda VK <avishwan@redhat.com>2017-06-15 07:20:56 +0000
commitb1a6297ec323bfda27068b9579d2848cd8f48b0d (patch)
tree6777c5bf2ea4233b30e854864d1fff7090817674
parentc5b81783d5532a3b3a2bd1948bd1c9bfa4a023e1 (diff)
geo-rep: Added metrics related to Sync Time
In Geo-rep, Sync jobs can be configured using, `config sync-jobs 3`. This patch adds following information related to the sync job(Rsync/Tarssh) Example output: [2017-06-13 09:09:32.532181] I [master(/bricks/b1):1713:syncjob] Syncer: \ Sync Time Taken (Job:2 Files:5484 ReturnCode:0): 4.8774 secs Change-Id: Ifceb96d4b8d14e00fd1290c0aeff60d64b4d7f37 BUG: 1455179 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: https://review.gluster.org/17531 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r--geo-replication/syncdaemon/master.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
index 3ec99d0f9c4..aebaf31dcff 100644
--- a/geo-replication/syncdaemon/master.py
+++ b/geo-replication/syncdaemon/master.py
@@ -1686,10 +1686,10 @@ class Syncer(object):
self.sync_engine = sync_engine
self.errnos_ok = resilient_errnos
for i in range(int(gconf.sync_jobs)):
- t = Thread(target=self.syncjob)
+ t = Thread(target=self.syncjob, args=(i+1, ))
t.start()
- def syncjob(self):
+ def syncjob(self, job_id):
"""the life of a worker"""
while True:
pb = None
@@ -1702,7 +1702,16 @@ class Syncer(object):
break
time.sleep(0.5)
pb.close()
+ start = time.time()
po = self.sync_engine(pb, self.log_err)
+ logging.info("Sync Time Taken (Job:{0} "
+ "Files:{1} ReturnCode:{2}): "
+ "{3:.4f} secs".format(
+ job_id,
+ len(pb),
+ po.returncode,
+ time.time() - start
+ ))
if po.returncode == 0:
ret = (True, 0)
elif po.returncode in self.errnos_ok: