Send CSP metrics to statsd

This commit is contained in:
YuviPanda
2016-03-31 16:42:25 -07:00
parent 80556360ac
commit cac5175c9b

View File

@@ -512,8 +512,12 @@ class CSPReportHandler(BaseHandler):
@web.authenticated @web.authenticated
def post(self): def post(self):
'''Log a content security policy violation report''' '''Log a content security policy violation report'''
self.log.warning("Content security violation: %s", self.log.warning(
self.request.body.decode('utf8', 'replace')) "Content security violation: %s",
self.request.body.decode('utf8', 'replace')
)
# Report it to statsd as well
self.statsd.incr('csp_report')
default_handlers = [ default_handlers = [
(r'/user/([^/]+)(/.*)?', UserSpawnHandler), (r'/user/([^/]+)(/.*)?', UserSpawnHandler),