Merge ~cjwatson/launchpad:rearrange-opstats-timeout into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 52f8e22cd91e0a39725ce24daa01093b5e7d0d2a
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:rearrange-opstats-timeout
Merge into: launchpad:master
Diff against target: 52 lines (+4/-5)
2 files modified
lib/lp/services/webapp/adapter.py (+0/-5)
lib/lp/services/webapp/publication.py (+4/-0)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+403817@code.launchpad.net

Commit message

Move timeout statistics to handleException

Description of the change

This is cleaner than doing it in the timeout tracer.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
2index a707e11..04a779a 100644
3--- a/lib/lp/services/webapp/adapter.py
4+++ b/lib/lp/services/webapp/adapter.py
5@@ -76,7 +76,6 @@ from lp.services.timeline.requesttimeline import (
6 from lp.services.timeout import set_default_timeout_function
7 from lp.services.webapp import LaunchpadView
8 from lp.services.webapp.interaction import get_interaction_extras
9-from lp.services.webapp.opstats import OpStats
10
11
12 __all__ = [
13@@ -625,9 +624,6 @@ class LaunchpadTimeoutTracer(PostgresTimeoutTracer):
14 super(LaunchpadTimeoutTracer, self).connection_raw_execute(
15 connection, raw_cursor, statement, params)
16 except (RequestExpired, TimeoutError):
17- # XXX: This code does not belong here - see bug=636804.
18- # Robert Collins 20100913.
19- OpStats.stats['timeouts'] += 1
20 # XXX bug=636801 Robert Colins 20100914 This is duplicated
21 # from the statement tracer, because the tracers are not
22 # arranged in a stack rather a queue: the done-code in the
23@@ -654,7 +650,6 @@ class LaunchpadTimeoutTracer(PostgresTimeoutTracer):
24 if not isinstance(connection._database, LaunchpadDatabase):
25 return
26 if isinstance(error, QueryCanceledError):
27- OpStats.stats['timeouts'] += 1
28 raise LaunchpadTimeoutError(statement, params, error)
29
30 def get_remaining_time(self):
31diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
32index b0dabea..e832679 100644
33--- a/lib/lp/services/webapp/publication.py
34+++ b/lib/lp/services/webapp/publication.py
35@@ -25,6 +25,7 @@ from storm.database import STATE_DISCONNECTED
36 from storm.exceptions import (
37 DisconnectionError,
38 IntegrityError,
39+ TimeoutError,
40 )
41 from storm.zope.interfaces import IZStorm
42 import transaction
43@@ -696,6 +697,9 @@ class LaunchpadBrowserPublication(
44 if isinstance(exc_info[1], DisconnectionError):
45 getUtility(IErrorReportingUtility).raising(exc_info, request)
46
47+ if isinstance(exc_info[1], (da.RequestExpired, TimeoutError)):
48+ OpStats.stats['timeouts'] += 1
49+
50 def should_retry(exc_info):
51 if not retry_allowed:
52 return False

Subscribers

People subscribed via source and target branches

to status/vote changes: