Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Django error e-mail is sent to site admins when Graphite is not responding properly #3259

Open
lunkwill42 opened this issue Dec 20, 2024 · 0 comments · May be fixed by #3260
Open

[BUG] Django error e-mail is sent to site admins when Graphite is not responding properly #3259

lunkwill42 opened this issue Dec 20, 2024 · 0 comments · May be fixed by #3260
Assignees
Labels

Comments

@lunkwill42
Copy link
Member

lunkwill42 commented Dec 20, 2024

Describe the bug

NAV's /graphite view works as a proxy to the configured graphite-web server for authenticated users (since graphite-web provides no proper authorization scheme):

def index(request, uri):
"""
Proxies render requests to graphite-web, as configured in graphite.conf
"""

The view proxies both response status codes and response bodies. There is, however, a drawback to the current implementation: Any 5XX type response code from graphite-web will trigger Django's log handler to send a full error message to the NAV site admins, even if there is no exception or error in NAV code (it simply triggers on the fact that the index() view function returns a HttpResponse object with status>=500).

We've seen cases where someone has built dashboards of NAV graphs, and if the dashboards refresh just as the graphite-web service is being restarted, hundreds of these e-mails are dispatched to the site admins, which is "inconvenient" (i.e. it is unnecessary noise!).

The sent email will often contain all request details, but no traceback, since there is no actual exception raised within the view code.

To Reproduce

  1. Open a NAV graph (e.g. something like this )
  2. Stop graphite-web (or replace it with a web service that always responds with e.g. 503 Service Unavailable).
  3. Reload the graph
  4. Observe e-mail received by site admin (only when running with DJANGO_DEBUG=False in nav.conf)

Expected behavior

5xx errors should be passed on to the client without error mails being sent to the site admins.

Environment (please complete the following information):

  • NAV version installed: 5.12.0 (and earlier)
@lunkwill42 lunkwill42 self-assigned this Dec 20, 2024
@lunkwill42 lunkwill42 removed the 802.1X label Dec 20, 2024
@lunkwill42 lunkwill42 linked a pull request Dec 20, 2024 that will close this issue
lunkwill42 added a commit that referenced this issue Dec 20, 2024
This adds a bit of complicated regression testing of #3259, which
causes Dango to send error e-mail to NAV site admins when the proxied
response code from Graphite-web is in the 5XX range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant