Skip to content

Commit

Permalink
chore(Sentry): only allow for Sentry testing with DEBUG on
Browse files Browse the repository at this point in the history
  • Loading branch information
afeld committed Feb 14, 2023
1 parent 67a7996 commit a64f408
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions benefits/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@
handler404 = "benefits.core.views.page_not_found"
handler500 = "benefits.core.views.server_error"


# based on
# https://docs.sentry.io/platforms/python/guides/django/#verify
def trigger_error(request):
raise RuntimeError("Test error")


urlpatterns = [
path("", include("benefits.core.urls")),
path("eligibility/", include("benefits.eligibility.urls")),
path("enrollment/", include("benefits.enrollment.urls")),
path("i18n/", include("django.conf.urls.i18n")),
path("oauth/", include("benefits.oauth.urls")),
path("sentry-debug/", trigger_error),
]

if settings.DEBUG:
# based on
# https://docs.sentry.io/platforms/python/guides/django/#verify

def trigger_error(request):
raise RuntimeError("Test error")

urlpatterns.append(path("error/", trigger_error))

if settings.ADMIN:
from django.contrib import admin

Expand Down
2 changes: 2 additions & 0 deletions docs/deployment/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Cal-ITP's Sentry instance collects both [errors ("Issues")](https://sentry.calit

[Alerts are sent to #benefits-notify in Slack.](https://sentry.calitp.org/organizations/sentry/alerts/rules/benefits/9/details/) [Others can be configured.](https://sentry.calitp.org/organizations/sentry/alerts/rules/)

You can troubleshoot Sentry itself by [turning on debug mode](../../configuration/environment-variables/#django_debug) and visiting `/error/`.

## Specific issues

This section serves as the [runbook](https://www.pagerduty.com/resources/learn/what-is-a-runbook/) for Benefits.
Expand Down

0 comments on commit a64f408

Please sign in to comment.