TimerMiddleware

Middleware to measure timing of different parts of your app
Download

TimerMiddleware Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Dave Brondsema, Tim Vansteenburgh, and other

TimerMiddleware Tags


TimerMiddleware Description

TimerMiddleware is a Python middleware to measure timing of different parts of your app.To use TimerMiddleware:- from timermiddleware import Timer, TimerMiddleware- extend TimerMiddleware and implement timers() e.g. return - add your extended TimerMiddleware to your app its config param should have a key called stats.sample_rate with a float in the range that will dictate what % of requests should be timed- configure 'stats' loggingFor example:level = INFOhandlers = statsqualname = statspropagate = 0class = handlers.RotatingFileHandlerargs = ('/tmp/stats.log','a',1048576,5)level = NOTSETformatter = statsformat = {"time": "%(asctime)s,%(msecs)03d", "level": "%(levelname)-5.5s", "name": "%(name)s", "message": %(message)s}datefmt = %Y-%m-%d %H:%M:%SBonus:Turn on DEBUG logging for timermiddleware and you get call details of each invocation. Add something like this to your logging.ini:level = DEBUGhandlers =qualname = timermiddlewareIf some Timers are too verbose, you can pass debug_each_call=False when you create that particular Timer.Product's homepage


TimerMiddleware Related Software