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 2017/10/22 21:31:35 UTC
[kibble] 01/05: make this actually work
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.git
commit 5258029b58c2cd38de396fd3875963fbdceb6764
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 22 23:30:27 2017 +0200
make this actually work
---
api/pages/mail/timeseries.py | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/api/pages/mail/timeseries.py b/api/pages/mail/timeseries.py
index b89b43a..75eb419 100644
--- a/api/pages/mail/timeseries.py
+++ b/api/pages/mail/timeseries.py
@@ -108,9 +108,9 @@ def run(API, environ, indata, session):
'must': [
{'range':
{
- 'ts': {
- 'from': dateFrom,
- 'to': dateTo
+ 'date': {
+ 'from': time.strftime("%Y/%m/%d 0:0:0", time.gmtime(dateFrom)),
+ 'to': time.strftime("%Y/%m/%d 23:59:59", time.gmtime(dateTo))
}
}
},
@@ -134,27 +134,45 @@ def run(API, environ, indata, session):
# Get number of committers, this period
query['aggs'] = {
- 'commits': {
+ 'timeseries': {
'date_histogram': {
'field': 'date',
'interval': interval
- }
+ },
+ 'aggs': {
+ 'email': {
+ 'sum': {
+ 'field': 'emails'
+ }
+ },
+ 'topics': {
+ 'sum': {
+ 'field': 'topics'
+ }
+ },
+ 'authors': {
+ 'sum': {
+ 'field': 'authors'
+ }
+ }
+ }
}
}
res = session.DB.ES.search(
index=session.DB.dbname,
- doc_type="email",
+ doc_type="mailstats",
size = 0,
body = query
)
timeseries = []
- for bucket in res['aggregations']['commits']['buckets']:
+ for bucket in res['aggregations']['timeseries']['buckets']:
ts = int(bucket['key'] / 1000)
- count = bucket['doc_count']
timeseries.append({
'date': ts,
- 'email': count
+ 'emails': bucket['email']['value'],
+ 'topics': bucket['topics']['value'],
+ 'authors': bucket['authors']['value']
})
JSON_OUT = {
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.