Merge lp:~lifeless/python-oops-tools/own-oops into lp:python-oops-tools

Proposed by Robert Collins
Status: Merged
Approved by: Robert Collins
Approved revision: not available
Merged at revision: 28
Proposed branch: lp:~lifeless/python-oops-tools/own-oops
Merge into: lp:python-oops-tools
Diff against target: 136 lines (+56/-3)
7 files modified
buildout-templates/bin/oopstools.wsgi.in (+28/-2)
buildout-templates/src/oopstools/settings.py.in (+7/-0)
buildout.cfg (+8/-0)
setup.py (+1/-0)
src/oopstools/NEWS.txt (+3/-0)
src/oopstools/README.txt (+8/-1)
versions.cfg (+1/-0)
To merge this branch: bzr merge lp:~lifeless/python-oops-tools/own-oops
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+85288@code.launchpad.net

Commit message

If oops-tools breaks, log an OOPS.

Description of the change

If oops-tools breaks, log an OOPS.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

self reviewing - this is 99% boilerplate.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'buildout-templates/bin/oopstools.wsgi.in'
2--- buildout-templates/bin/oopstools.wsgi.in 2011-10-13 20:18:51 +0000
3+++ buildout-templates/bin/oopstools.wsgi.in 2011-12-12 06:17:24 +0000
4@@ -11,5 +11,31 @@
5 os.environ['DJANGO_SETTINGS_MODULE'] = "oopstools.settings"
6
7 import django.core.handlers.wsgi
8-
9-application = django.core.handlers.wsgi.WSGIHandler()
10+from oops_wsgi.django import OOPSWSGIHandler
11+
12+application = OOPSWSGIHandler()
13+
14+# Report OOPSes back to us.
15+from functools import partial
16+from oops import Config
17+from oops_wsgi import make_app, install_hooks
18+# Transports - AMQP live (dev only service, no need for fallback transport)
19+from oops_amqp import Publisher
20+from amqplib import client_0_8 as amqp
21+
22+from django.conf import settings
23+
24+config = Config()
25+config.template['reporter'] = '${configuration:oops-web-amqp-reporter}'
26+install_hooks(config)
27+# Can add custom filters / hooks if needed - see docs.
28+factory = partial(amqp.Connection, host=settings.OOPS_WEB_AMQP_HOST,
29+ userid=settings.OOPS_WEB_AMQP_USER,
30+ password=settings.OOPS_WEB_AMQP_PASSWORD,
31+ virtual_host=settings.OOPS_WEB_AMQP_VHOST, insist=False)
32+publisher = Publisher(
33+ factory, settings.OOPS_WEB_AMQP_EXCHANGE, settings.OOPS_WEB_AMQP_ROUTING)
34+config.publishers.append(publisher)
35+
36+# finally we can wrap the app with OOPS reporting
37+application = make_app(application, config, oops_on_status=['500'])
38
39=== modified file 'buildout-templates/src/oopstools/settings.py.in'
40--- buildout-templates/src/oopstools/settings.py.in 2011-10-13 20:18:51 +0000
41+++ buildout-templates/src/oopstools/settings.py.in 2011-12-12 06:17:24 +0000
42@@ -113,3 +113,10 @@
43 'oopstools.oops',
44 'south'
45 )
46+
47+OOPS_WEB_AMQP_HOST = '${configuration:oops-web-amqp-host}'
48+OOPS_WEB_AMQP_USER = '${configuration:oops-web-amqp-user}'
49+OOPS_WEB_AMQP_PASSWORD = '${configuration:oops-web-amqp-password}'
50+OOPS_WEB_AMQP_VHOST = '${configuration:oops-web-amqp-vhost}'
51+OOPS_WEB_AMQP_EXCHANGE = '${configuration:oops-web-amqp-exchange}'
52+OOPS_WEB_AMQP_ROUTING = '${configuration:oops-web-amqp-routing}'
53
54=== modified file 'buildout.cfg'
55--- buildout.cfg 2011-10-16 23:00:57 +0000
56+++ buildout.cfg 2011-12-12 06:17:24 +0000
57@@ -49,6 +49,14 @@
58 report-to-address = test@example.com
59 # Email address reports should be sent from.
60 report-from-address = test@example.com
61+# Details for publishing OOPS reports that occur in the django web UI itself.
62+oops-web-amqp-host = localhost
63+oops-web-amqp-user = guest
64+oops-web-amqp-password = guest
65+oops-web-amqp-vhost = /
66+oops-web-amqp-exchange = oopses
67+oops-web-amqp-routing =
68+oops-web-amqp-reporter = oops-tools-dev
69
70 [django]
71 recipe = djangorecipe
72
73=== modified file 'setup.py'
74--- setup.py 2011-12-08 05:26:06 +0000
75+++ setup.py 2011-12-12 06:17:24 +0000
76@@ -56,6 +56,7 @@
77 'oops',
78 'oops-amqp',
79 'oops-datedir-repo',
80+ 'oops-wsgi',
81 'psycopg2',
82 'pytz',
83 'setuptools',
84
85=== modified file 'src/oopstools/NEWS.txt'
86--- src/oopstools/NEWS.txt 2011-12-08 03:44:45 +0000
87+++ src/oopstools/NEWS.txt 2011-12-12 06:17:24 +0000
88@@ -12,6 +12,9 @@
89 the disk copy of the failed OOPS, to ease debugging.
90 (Robert Collins, #892914)
91
92+* Failures in the Django web UI will now raise an OOPS over AMQP, making
93+ oops-tools an oops-tools consumer. (Robert Collins)
94+
95 * Flush stdout when logging an OOPS receipt in amqp2disk.
96 (Robert Collins, #884569)
97
98
99=== modified file 'src/oopstools/README.txt'
100--- src/oopstools/README.txt 2011-10-16 22:35:01 +0000
101+++ src/oopstools/README.txt 2011-12-12 06:17:24 +0000
102@@ -61,7 +61,9 @@
103 oopsdir = /path/where/rsynced/oopses/are/found
104 /another/such/path
105
106-Update settings.py setting a custom SECRET_KEY
107+Update settings.py setting a custom SECRET_KEY, and appropriate AMQP connection
108+details (so that the oops-tools web site itself can report errors, should they
109+occur).
110
111 To deploy oops tools make sure all the dependecies are installed.
112
113@@ -82,6 +84,11 @@
114 creation to publish over AMQP. If you are using Python then the oops-amqp
115 module will help you do this.
116
117+The Django web UI also integrates with AMQP to report errors that occur
118+rendering or searching for OOPS reports. The settings to control this are in
119+settings.py (or in your configuration file which buildout compiles into a
120+settings.py).
121+
122 Running locally
123 ===============
124
125
126=== modified file 'versions.cfg'
127--- versions.cfg 2011-12-08 18:32:44 +0000
128+++ versions.cfg 2011-12-12 06:17:24 +0000
129@@ -22,6 +22,7 @@
130 oops = 0.0.10
131 oops-amqp = 0.0.5
132 oops-datedir-repo = 0.0.15
133+oops-wsgi = 0.0.9
134 # XXX: 2011-11-17 GavinPanella bug=891249: pyscopg2 2.4.2 is
135 # incompatible with Django 1.3, but 2.4.1 works fine.
136 psycopg2 = 2.4.1

Subscribers

People subscribed via source and target branches

to all changes: