Skip to content

Commit c0939ed

Browse files
committed
sentry update
1 parent 28a151e commit c0939ed

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

CHANGES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1.7.11 (unreleased)
22
-------------------
33

4-
- Nothing changed yet.
4+
- updates for sentry [amleczko]
55

66

77
1.7.10 (2013-05-21)

por/dashboard/ravenlog.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from raven.middleware import Sentry
2+
from raven.base import Client
3+
from raven.utils.wsgi import get_current_url, get_headers, get_environ
4+
5+
6+
class PenelopeSentry(Sentry):
7+
8+
def cleanup_headers(self, headers):
9+
if 'Cookie' in headers:
10+
del headers['Cookie']
11+
return headers
12+
13+
def handle_exception(self, environ):
14+
event_id = self.client.captureException(
15+
data={
16+
'sentry.interfaces.Http': {
17+
'method': environ.get('REQUEST_METHOD'),
18+
'url': get_current_url(environ, strip_querystring=True),
19+
'query_string': environ.get('QUERY_STRING'),
20+
'headers': self.cleanup_headers(dict(get_headers(environ))),
21+
'env': dict(get_environ(environ)),
22+
}
23+
},
24+
)
25+
return event_id
26+
27+
28+
def sentry_filter_factory(app, global_conf, **kwargs):
29+
client = Client(**kwargs)
30+
return PenelopeSentry(app, client)

setup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
'Beaker',
5454
'js.jquery_datatables==1.8.2',
5555
'unittest2',
56-
'bleach'
56+
'bleach',
57+
'raven'
5758
]
5859

5960
if sys.version_info[:3] < (2,5,0):
@@ -80,6 +81,8 @@
8081
entry_points = """\
8182
[paste.app_factory]
8283
main = por.dashboard:main
84+
[paste.filter_app_factory]
85+
raven = por.dashboard.ravenlog:sentry_filter_factory
8386
[fanstatic.libraries]
8487
por = por.dashboard.fanstatic_resources:por_library
8588
deform_library = por.dashboard.fanstatic_resources:deform_library

0 commit comments

Comments
 (0)