Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
bug: silence missing TTL errors from sentry log
Browse files Browse the repository at this point in the history
Missing TTL headers are being logged resulting in high levels of noise
in the Sentry logs. Set the "log_exception" param to False to prevent
the message from going to the system log.

closes #370
  • Loading branch information
jrconlin committed Feb 24, 2016
1 parent 077ccbc commit c167ee2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autopush/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _router_fail_err(self, fail):
fail.trap(RouterException)
exc = fail.value
if exc.log_exception:
log.err(fail, **self._client_info)
log.err(fail, **self._client_info) # pragma nocover
if 200 <= exc.status_code < 300:
log.msg("Success", status_code=exc.status_code,
logged_status=exc.logged_status or "",
Expand Down
3 changes: 2 additions & 1 deletion autopush/router/webpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def _save_notification(self, uaid, notification, month_table):
"Missing TTL Header",
response_body="Missing TTL Header, see: %s" % TTL_URL,
status_code=400,
errno=111
errno=111,
log_exception=False,
)
if notification.ttl == 0:
location = "%s/m/%s" % (self.ap_settings.endpoint_url,
Expand Down
6 changes: 4 additions & 2 deletions autopush/tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ def raise_error(*args):
"Missing TTL Header",
status_code=400,
response_body="Missing TTL Header",
errno=111
errno=111,
log_exception=False,
)

self.wp_router_mock.route_notification.side_effect = raise_error
Expand Down Expand Up @@ -1108,7 +1109,8 @@ def raise_error(*args):
"Provisioned throughput error",
status_code=503,
response_body="Retry Request",
errno=201
errno=201,
log_exception=False
)

self.wp_router_mock.route_notification.side_effect = raise_error
Expand Down

0 comments on commit c167ee2

Please sign in to comment.