Created
February 3, 2017 04:52
-
-
Save novel/3df0828cb1ab57de9ba6880243641ce1 to your computer and use it in GitHub Desktop.
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
import pprint | |
from osprofiler.drivers.base import get_driver | |
CONN = "mongodb://localhost" | |
if __name__ == "__main__": | |
drv = get_driver(CONN) | |
fields = ['base_id', 'timestamp', 'info.request.path'] | |
traces = drv.list_traces({}, fields) | |
for trace in traces: | |
if trace['info']: | |
report = drv.get_report(trace['base_id']) | |
print "%s %s: %s sec" % (trace['base_id'], | |
trace['info']['request']['path'], | |
int(report['info']['finished'] / 1000.0)) | |
per_request_aggr_time = 0 | |
for k, v in report['stats'].items(): | |
per_request_aggr_time += int(v["duration"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment