← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:talisker-log-sql into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:talisker-log-sql into launchpad:master.

Commit message:
Log SQL statements and duration to Talisker as well

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/405568
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:talisker-log-sql into launchpad:master.
diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
index e316f91..575e855 100644
--- a/lib/lp/services/webapp/publication.py
+++ b/lib/lp/services/webapp/publication.py
@@ -536,6 +536,8 @@ class LaunchpadBrowserPublication(
         if publication_thread_duration is not None:
             tracelog_entry += ' %d' % (publication_thread_duration * 1000)
         tracelog(request, 't', tracelog_entry)
+        logging_context.push(
+            sql_statements=len(sql_statements), sql_ms=sql_milliseconds)
 
         # Annotate the transaction with user data. That was done by
         # zope.app.publication.zopepublication.ZopePublication.