-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add support for warnings that do not error endpoints #193
Conversation
Codecov Report
@@ Coverage Diff @@
## master #193 +/- ##
==========================================
+ Coverage 73.92% 75.56% +1.63%
==========================================
Files 28 29 +1
Lines 303 311 +8
==========================================
+ Hits 224 235 +11
+ Misses 79 76 -3
Continue to review full report at Codecov.
|
Add a new concept of warnings and non-critical services. Both will not cause the template and JSON endpoint to response with a 500 status code but with a regular 200. This change is backwards compatible because the existing warnings are treated as errors by default. Close #191
health_check/views.py
Outdated
@@ -23,14 +25,20 @@ def get(self, request, *args, **kwargs): | |||
def _run(plugin): | |||
plugin.run_check() | |||
try: | |||
return plugin.errors | |||
return plugin.errors, plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we don't just return plugin
here? Either way we're changing the method signature, but given it's declared within the scope of the view itself, no one else should be relying on it. Seems cleaner that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, thanks!
from health_check.exceptions import ( | ||
ServiceReturnedUnexpectedResult, ServiceWarning | ||
) | ||
|
||
host = socket.gethostname() | ||
|
||
if hasattr(settings, 'HEALTH_CHECK'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, these were getting ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it has outlived it's design.
Released in 3.6.0 |
Add a new concept of warnings and non-critical services. Both
will not cause the template and JSON endpoint to response with a
500 status code but with a regular 200. This change is backwards
compatible because the existing warnings are treated as errors by
default.
Close #191