Opened 10 years ago

Closed 6 years ago

#2452 enhancement closed wontfix (wontfix)

Add a timestamp to web2.server.Request for performance tracking

Reported by: Cyrus Daboo Owned by:
Priority: normal Milestone:
Component: web2 Keywords:
Cc: exarkun, thijs Branch:


It is useful to record in an access log the total time taken to process a request. I propose adding an attribute to the init method of Request that records the time when the request object is created. That timestamp can then be used later during the processing of the request to determine elapsed time or to print the total request time in an access log when the request is complete. This will also aid with tracking down performance issues by making it easy to log elapsed time during different portions of request processing.

Proposed patches attached. One adds the timestamp to the Request object, the other modifies the access log output to include the total request elapsed time in milliseconds.

Attachments (2)

server.patch (458 bytes) - added by Cyrus Daboo 10 years ago.
log.patch (886 bytes) - added by Cyrus Daboo 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by Cyrus Daboo

Changed 10 years ago by Cyrus Daboo

comment:1 Changed 10 years ago by Cyrus Daboo

  • Keywords review added

comment:2 Changed 10 years ago by exarkun

  • Cc exarkun added
  • Keywords review removed

There should be test coverage for this functionality. Preferably the clock used (time.time) should be parameterized so that the tests are deterministic. It might also be useful if either wallclock time or CPU time could be logged (or both), but that's more a new feature request than criticism of this patch.

I'm not sure about this, but I think the current log format is based some standard (de facto or otherwise). Does the addition of a new field break this?

comment:3 Changed 6 years ago by <automation>

  • Owner jknight deleted

comment:4 Changed 6 years ago by thijs

  • Cc thijs added
  • Resolution set to wontfix
  • Status changed from new to closed

web2's gone.

Note: See TracTickets for help on using tickets.