Merge lp:~ricardokirkner/rnr-server/sentry into lp:rnr-server

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 325
Merged at revision: 324
Proposed branch: lp:~ricardokirkner/rnr-server/sentry
Merge into: lp:rnr-server
Diff against target: 128 lines (+32/-4)
5 files modified
django_project/settings_base.py (+19/-0)
django_project/settings_devel.py (+1/-0)
requirements.txt (+2/-0)
src/core/wsgi.py (+6/-3)
src/reviewsapp/templates/500.html (+4/-1)
To merge this branch: bzr merge lp:~ricardokirkner/rnr-server/sentry
Reviewer Review Type Date Requested Status
Matt Goodall (community) Approve
Review via email: mp+320167@code.launchpad.net

Commit message

add sentry support

To post a comment you must log in.
Revision history for this message
Matt Goodall (matt-goodall) wrote :

lgtm, with inline question. Approving now to not block.

review: Approve
lp:~ricardokirkner/rnr-server/sentry updated
325. By Ricardo Kirkner

remove unnecessary celery related settings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/settings_base.py'
2--- django_project/settings_base.py 2016-05-25 14:09:04 +0000
3+++ django_project/settings_base.py 2017-03-17 12:11:25 +0000
4@@ -1,5 +1,7 @@
5 import os.path
6
7+from versioninfo import version_info
8+
9
10 BASE_DIR = os.path.dirname(os.path.dirname(__file__))
11 SRC_DIR = os.path.join(BASE_DIR, 'src')
12@@ -141,6 +143,8 @@
13 'piston',
14 'preflight',
15 'pgtools',
16+ 'raven.contrib.django.raven_compat',
17+ 'canonical_raven',
18 ]
19 INTERNAL_IPS = []
20 LANGUAGES = [
21@@ -286,6 +290,8 @@
22 MEDIA_URL = '/site_media/'
23 MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
24 MIDDLEWARE_CLASSES = [
25+ 'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', #noqa
26+ 'canonical_raven.middleware.RavenContextMiddleware',
27 'django.middleware.http.ConditionalGetMiddleware',
28 'django.middleware.cache.UpdateCacheMiddleware',
29 'django.middleware.common.CommonMiddleware',
30@@ -340,6 +346,18 @@
31 PRELOAD_API_SERVICE_ROOTS = False
32 PREPEND_WWW = False
33 PROFANITIES_LIST = []
34+RAVEN_CONFIG = {
35+ # 'dsn': 'http://api:key@sentry.host/project_id',
36+ 'release': version_info['revno'],
37+ 'string_max_length': 16000,
38+ 'processors': [
39+ 'raven.processors.SanitizePasswordsProcessor',
40+ 'raven.processors.RemoveStackLocalsProcessor',
41+ 'raven.processors.RemovePostDataProcessor',
42+ 'canonical_raven.processors.RemoveCookiesProcessor',
43+ 'canonical_raven.processors.SanitizeTimelineDjangoProcessor',
44+ ],
45+}
46 REVIEWSAPP_MEDIA_ROOT = os.path.join(SRC_DIR, 'reviewsapp', 'media')
47 ROOT_URLCONF = 'urls'
48 SCA_APPS_CACHE_TIMEOUT = 3600
49@@ -423,6 +441,7 @@
50 USE_ETAGS = False
51 USE_I18N = True
52 USE_L10N = True
53+USE_SENTRY = True
54 USE_THOUSAND_SEPARATOR = False
55 USE_TZ = True
56 USE_X_FORWARDED_HOST = True
57
58=== modified file 'django_project/settings_devel.py'
59--- django_project/settings_devel.py 2015-12-14 07:43:03 +0000
60+++ django_project/settings_devel.py 2017-03-17 12:11:25 +0000
61@@ -14,3 +14,4 @@
62 os.path.join(BASE_DIR, 'django_project', 'templates'),
63 ]
64 STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
65+USE_SENTRY = False
66
67=== modified file 'requirements.txt'
68--- requirements.txt 2016-05-13 14:05:48 +0000
69+++ requirements.txt 2017-03-17 12:11:25 +0000
70@@ -1,4 +1,5 @@
71 amqp==1.4.5
72+canonical-raven==0.0.3
73 django==1.6.10
74 django-openid-auth==0.6 # bzr+ssh://bazaar.launchpad.net/~ubuntuone-pqm-team/django-openid-auth/trunk@114
75 django-pgtools==0.2 # bzr+ssh://bazaar.launchpad.net/~canonical-isd-hackers/django-pgtools/trunk@8
76@@ -12,6 +13,7 @@
77 oops-dictconfig==0.0.4
78 oops-wsgi==0.0.11 # bzr+ssh://bazaar.launchpad.net/~ubuntuone-pqm-team/python-oops-wsgi/stable@39
79
80+raven==5.6.0
81 requests==2.6.0
82 requests-oauthlib==0.5.0
83 south==1.0.2
84
85=== modified file 'src/core/wsgi.py'
86--- src/core/wsgi.py 2015-06-12 04:56:30 +0000
87+++ src/core/wsgi.py 2017-03-17 12:11:25 +0000
88@@ -2,6 +2,7 @@
89 import oops_wsgi
90 import uuid
91
92+from canonical_raven.middleware import Sentry
93 from django.conf import settings
94 from django.core.handlers import wsgi
95
96@@ -67,9 +68,11 @@
97 config = oops_dictconfig.config_from_dict(settings.OOPSES)
98 oops_wsgi.install_hooks(config)
99 soft_timeout = settings.SOFT_TIMEOUT_MILLISECONDS
100- oops_app = oops_wsgi.make_app(non_oops_app, config, oops_on_status=['500'],
101- soft_start_timeout=soft_timeout)
102- return oops_app
103+ app = oops_wsgi.make_app(non_oops_app, config, oops_on_status=['500'],
104+ soft_start_timeout=soft_timeout)
105+ if settings.USE_SENTRY:
106+ app = Sentry(app, soft_start_timeout=soft_timeout)
107+ return app
108
109
110 application = make_app()
111
112=== modified file 'src/reviewsapp/templates/500.html'
113--- src/reviewsapp/templates/500.html 2014-01-03 11:11:18 +0000
114+++ src/reviewsapp/templates/500.html 2017-03-17 12:11:25 +0000
115@@ -9,9 +9,12 @@
116 <h1>{% trans 'Server Error <em>(500)</em>' %}</h1>
117 {% if errormsg %}<p>{{ errormsg }}</p>{% endif %}
118 <p>{% blocktrans %}An error occurred which prevented the page you requested from loading. If this problem continues, please consider reporting this problem by sending an e-mail to <a href="mailto:webmaster@canonical.com">webmaster@canonical.com</a>{% endblocktrans %}</p>
119-<p>
120+<p id="oops_id">
121 {% blocktrans %}(Error <abbr>ID</abbr>: ){% endblocktrans %} {{ oops_id }}
122 </p>
123+{% if request.sentry.id %}
124+<p id="sentry_id">Sentry ID: {{ request.sentry.id }}</p>
125+{% endif %}
126 <pre style="overflow:auto">
127 {{ traceback }}
128 </pre>

Subscribers

People subscribed via source and target branches