Created
November 26, 2015 17:41
-
-
Save otobrglez/cc72acb04461b35342c1 to your computer and use it in GitHub Desktop.
Experimenting with map-reduce / aggregation in RethinkDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// successful jobs grouped by type maped by req/sec | |
r.db('qm_production').table('jobs') | |
.filter({'last_event_type': 'success'}) | |
.map(function(doc) { | |
return { | |
'ds_type': doc('ds_type'), | |
'last_event_type': doc('last_event_type'), | |
'res_sec': doc("stats_event_response_count").div(doc('stats_run_duration')), | |
'req_sec': doc("stats_event_request_count").div(doc('stats_run_duration')) | |
}; | |
}) | |
.group('ds_type') | |
.avg('res_sec') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment