You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/02/16 18:06:13 UTC

[kibble-scanners] branch master updated: fix queue avg calc, add date key

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git


The following commit(s) were added to refs/heads/master by this push:
     new 5229665  fix queue avg calc, add date key
5229665 is described below

commit 5229665a4392ca7918b850704e4261fd50c63736
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Feb 16 19:06:01 2018 +0100

    fix queue avg calc, add date key
    
    avg needs to use max, not min.
    add date, so we can do aggregations on dates
---
 src/plugins/scanners/jenkins.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/scanners/jenkins.py b/src/plugins/scanners/jenkins.py
index 3825cdd..6553a61 100644
--- a/src/plugins/scanners/jenkins.py
+++ b/src/plugins/scanners/jenkins.py
@@ -210,11 +210,12 @@ def scan(KibbleBit, source):
             if 'inQueueSince' in item:
                 totalqueuetime += (NOW - int(item['inQueueSince']/1000))
         
-        avgqueuetime = totalqueuetime / min(1, len(items))
+        avgqueuetime = totalqueuetime / max(1, len(items))
         
         # Write up a queue doc
         queuedoc = {
             'id': queuehash,
+            'date': time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(NOW)),
             'time': NOW,
             'size': len(items),
             'blocked': blocked,

-- 
To stop receiving notification emails like this one, please contact
humbedooh@apache.org.