Adding additional failure conditions to sentry tracking. (#853)

* Adding additional failure conditions to sentry tracking.

* Removing sentry extension as a circular import.
This commit is contained in:
kevgliss
2017-07-13 14:49:04 -07:00
committed by GitHub
parent 6779e19ac9
commit 61c493fc91
6 changed files with 54 additions and 34 deletions

View File

@ -18,6 +18,7 @@ from flask import current_app
from sqlalchemy import and_
from lemur import database, metrics
from lemur.extensions import sentry
from lemur.common.utils import windowed_query
from lemur.certificates.schemas import certificate_notification_output_schema
@ -98,6 +99,7 @@ def send_notification(event_type, data, targets, notification):
metrics.send('{0}_notification_sent'.format(event_type), 'counter', 1)
return True
except Exception as e:
sentry.captureException()
metrics.send('{0}_notification_failure'.format(event_type), 'counter', 1)
current_app.logger.exception(e)
@ -157,6 +159,7 @@ def send_rotation_notification(certificate, notification_plugin=None):
metrics.send('rotation_notification_sent', 'counter', 1)
return True
except Exception as e:
sentry.captureException()
metrics.send('rotation_notification_failure', 'counter', 1)
current_app.logger.exception(e)