Improved bugsnag reporting

- Include release stage, which should be 'production' or 'development',
  and gets postfixed by '-debug' when running in debug mode.
- Properly logging remote IP address when proxied through HAProxy;
- Log user ID, email, username, roles, and capabilities;
- Remove authentication tokens from logged session;
- Log request data and JSON separately.
- Added request endpoint.
This commit is contained in:
2017-09-28 13:28:12 +02:00
parent ec42d033b3
commit 6a541e0662
3 changed files with 59 additions and 2 deletions

View File

@@ -183,9 +183,14 @@ class PillarServer(Eve):
import bugsnag
from bugsnag.handlers import BugsnagHandler
release_stage = self.config.get('BUGSNAG_RELEASE_STAGE', 'unconfigured')
if self.config.get('DEBUG'):
release_stage += '-debug'
bugsnag.configure(
api_key=bugsnag_api_key,
project_root="/data/git/pillar/pillar",
release_stage=release_stage
)
bs_handler = BugsnagHandler()
@@ -196,9 +201,9 @@ class PillarServer(Eve):
# but it passes the app to the connect() call, which causes an
# error. Since we only have one app, we can do without.
from flask import got_request_exception
from bugsnag.flask import add_flask_request_to_notification
from . import bugsnag_extra
bugsnag.before_notify(add_flask_request_to_notification)
bugsnag.before_notify(bugsnag_extra.add_pillar_request_to_notification)
got_request_exception.connect(self.__notify_bugsnag)
self.log.info('Bugsnag setup complete')