mongodb - how to calculate percentile -
i have access logs below, stored in mongodb instance:
time service latency [27/08/2013:11:19:22 +0000] "post service http/1.1" 403 [27/08/2013:11:19:24 +0000] "post service b http/1.1" 1022 [27/08/2013:11:22:10 +0000] "post service http/1.1" 455
is there analytics function percentile_disc in oracle calculate percentile? ot calcualte latency percentiles on period of time.
there still appears no native way calculate percentiles combining few aggregate operators can same result.
db.items.aggregate([ {'$group': { '_id': { 'league': '$league', 'base': '$base', 'type': '$type' }, 'value': {'$push': '$chaosequiv'} }}, {'$unwind': '$value'}, {'$sort': {'value': 1}}, {'$group': {'_id': '$_id', 'value': {'$push': '$value'}}}, {'$project': { '_id': 1, 'value': {'$arrayelemat': ['$value', {'$floor': {'$multiply': [0.25, {'$size': '$value'}]}}]} }} ], allowdiskuse=true)
note wrote original code in pymongo problem needed group on 3 fields in first group may more complex necessary single field. write solution specific question don't think there enough specific information.
Comments
Post a Comment