Skip to content

Commit

Permalink
bug 734394: send mail about server side errors on balrog servers. r=c…
Browse files Browse the repository at this point in the history
…atlee
  • Loading branch information
bhearsum committed Mar 8, 2013
1 parent cb4dd64 commit cc3f520
Show file tree
Hide file tree
Showing 90 changed files with 5,852 additions and 0 deletions.
1 change: 1 addition & 0 deletions admin.ini-dist
Expand Up @@ -7,6 +7,7 @@
;Where to put the application log. No rotation is done on this file.
logfile=/var/log/aus.log
;level=ERROR
;sentry_dsn='threaded+https://abc:def@errormill.mozilla.org/12'

[app]
; encryption key for session cookies. should be a few hundred bits
Expand Down
7 changes: 7 additions & 0 deletions admin.wsgi
Expand Up @@ -7,6 +7,8 @@ mydir = path.dirname(path.abspath(__file__))
site.addsitedir(mydir)
site.addsitedir(path.join(mydir, 'vendor/lib/python'))

from raven.contrib.flask import Sentry

from auslib import log_format
from auslib.admin.base import db, app as application
from auslib.config import AdminConfig
Expand All @@ -22,3 +24,8 @@ if errors:
logging.basicConfig(filename=cfg.getLogfile(), level=cfg.getLogLevel(), format=log_format)
db.setDburi(cfg.getDburi())
application.config['SECRET_KEY'] = cfg.getSecretKey()
application.config['SENTRY_DSN'] = cfg.getSentryDsn()
application.config['SENTRY_PROCESSORS'] = ['auslib.util.sentry.SanitizeHeadersProcessor']

if application.config['SENTRY_DSN']:
sentry = Sentry(application)
6 changes: 6 additions & 0 deletions auslib/config.py
Expand Up @@ -45,6 +45,12 @@ def getLogLevel(self):
def getDburi(self):
return self.cfg.get('database', 'dburi')

def getSentryDsn(self):
if self.cfg.has_option('logging', 'sentry_dsn'):
return self.cfg.get('logging', 'sentry_dsn')
else:
return None

class AdminConfig(AUSConfig):
required_options = {
'logging': ['logfile'],
Expand Down
12 changes: 12 additions & 0 deletions auslib/util/sentry.py
@@ -0,0 +1,12 @@
from raven.processors import Processor

class SanitizeHeadersProcessor(Processor):
sanitizeHeaders = ['Authorization']

def process(self, data):
data = data['sentry.interfaces.Http']
if 'headers' in data:
for header in self.sanitizeHeaders:
if header in data['headers']:
data['headers'][header] = 'REDACTED'
return data
1 change: 1 addition & 0 deletions balrog.ini-dist
Expand Up @@ -7,6 +7,7 @@
;Where to put the application log. No rotation is done on this file.
logfile=/var/log/aus.log
;level=ERROR
;sentry_dsn='threaded+https://abc:def@errormill.mozilla.org/12'

[site-specific]
;Sites that get the force=1 appended to download urls, comma separated supported
Expand Down
7 changes: 7 additions & 0 deletions balrog.wsgi
Expand Up @@ -7,6 +7,8 @@ mydir = path.dirname(path.abspath(__file__))
site.addsitedir(mydir)
site.addsitedir(path.join(mydir, 'vendor/lib/python'))

from raven.contrib.flask import Sentry

from auslib import log_format
from auslib.web.base import app as application
from auslib.web.base import AUS
Expand All @@ -23,3 +25,8 @@ if errors:
logging.basicConfig(filename=cfg.getLogfile(), level=cfg.getLogLevel(), format=log_format)
AUS.setDb(cfg.getDburi())
AUS.setSpecialHosts(cfg.getSpecialForceHosts())
application.config['SENTRY_DSN'] = cfg.getSentryDsn()
application.config['SENTRY_PROCESSORS'] = ['auslib.util.sentry.SanitizeHeadersProcessor']

if application.config['SENTRY_DSN']:
sentry = Sentry(application)
2 changes: 2 additions & 0 deletions requirements/prod.txt
Expand Up @@ -5,3 +5,5 @@ flask-wtf==0.6
sqlalchemy-migrate==0.7.2
tempita==0.5.1
decorator==3.3.3
raven==3.1.13
blinker==1.2
75 changes: 75 additions & 0 deletions vendor/lib/python/blinker-1.2.egg-info/PKG-INFO
@@ -0,0 +1,75 @@
Metadata-Version: 1.1
Name: blinker
Version: 1.2
Summary: Fast, simple object-to-object and broadcast signaling
Home-page: http://discorporate.us/projects/Blinker/
Author: Jason Kirtland
Author-email: jek@discorporate.us
License: MIT License
Description: Blinker
=======

Blinker provides a fast dispatching system that allows any number of
interested parties to subscribe to events, or "signals".

Signal receivers can subscribe to specific senders or receive signals
sent by any sender.

>>> from blinker import signal
>>> started = signal('round-started')
>>> def each(round):
... print "Round %s!" % round
...
>>> started.connect(each)

>>> def round_two(round):
... print "This is round two."
...
>>> started.connect(round_two, sender=2)

>>> for round in range(1, 4):
... started.send(round)
...
Round 1!
Round 2!
This is round two.
Round 3!

Requirements
------------

Blinker requires Python 2.4 or higher, Python 3.0 or higher, or Jython 2.5 or higher.

Changelog Summary
-----------------

1.1 (July 21, 2010)
- Added ``@signal.connect_via(sender)`` decorator
- Added ``signal.connected_to`` shorthand name for the
``temporarily_connected_to`` context manager.

1.0 (March 28, 2010)
- Python 3.x compatibility

0.9 (February 26, 2010)
- Sphinx docs, project website
- Added ``with a_signal.temporarily_connected_to(receiver): ...`` support

Keywords: signal emit events broadcast
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
9 changes: 9 additions & 0 deletions vendor/lib/python/blinker-1.2.egg-info/SOURCES.txt
@@ -0,0 +1,9 @@
README
blinker/__init__.py
blinker/_saferef.py
blinker/_utilities.py
blinker/base.py
blinker.egg-info/PKG-INFO
blinker.egg-info/SOURCES.txt
blinker.egg-info/dependency_links.txt
blinker.egg-info/top_level.txt
@@ -0,0 +1 @@

13 changes: 13 additions & 0 deletions vendor/lib/python/blinker-1.2.egg-info/installed-files.txt
@@ -0,0 +1,13 @@
../blinker/_utilities.py
../blinker/__init__.py
../blinker/_saferef.py
../blinker/base.py
../blinker/_utilities.pyc
../blinker/__init__.pyc
../blinker/_saferef.pyc
../blinker/base.pyc
./
PKG-INFO
dependency_links.txt
SOURCES.txt
top_level.txt
1 change: 1 addition & 0 deletions vendor/lib/python/blinker-1.2.egg-info/top_level.txt
@@ -0,0 +1 @@
blinker
20 changes: 20 additions & 0 deletions vendor/lib/python/blinker/__init__.py
@@ -0,0 +1,20 @@
from blinker.base import (
ANY,
NamedSignal,
Namespace,
Signal,
receiver_connected,
signal,
)

__all__ = [
'ANY',
'NamedSignal',
'Namespace',
'Signal',
'receiver_connected',
'signal',
]


__version__ = '1.2'

0 comments on commit cc3f520

Please sign in to comment.