-
Notifications
You must be signed in to change notification settings - Fork 62
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
Feature/bare status #114
Feature/bare status #114
Conversation
Thanks for the submission, I’ll try to take a look soon. 😊 |
@mwarkentin Did you get a chance to look at this yet? |
Hey @jamesmallen - initial review looks good, just trying to review the diff in |
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.
@jamesmallen Sorry about the delay - had a chance to run through it and I think everything looks good. Just a few small tweaks and I'll be happy to merge!
watchman/views.py
Outdated
def dashboard(request): | ||
_deprecation_warnings() | ||
def bare_status(request): | ||
checks, ok = run_checks(request) |
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.
Do you want to handle the "no checks" case here or are you ok with a 200
even if nothing has been checked?
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.
For our needs, a 200 even if nothing has been checked is fine - that is a legitimate situation where the webserver is up and responding from our POV (and there might not be any other subsystems to 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.
👍
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.
Not sure if you saw the ping endpoint which was added in the previous release, it’s use case is very similar.
@@ -172,6 +172,17 @@ requests, you can call ping: | |||
It will return the text ``pong`` with a 200 status code. Calling this doesn't | |||
run any of the checks. | |||
|
|||
Bare status view |
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.
Can you add a 0.15.0 (Unreleased)
heading to the history file and add a bullet for this feature?
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.
Fixed in 657f135
self.assertEqual(response.content.decode(), '') | ||
|
||
@patch('watchman.checks._check_databases') | ||
@override_settings(WATCHMAN_ERROR_CODE=503) |
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.
Can you add another test that the default error code for the bare status view will be 500
? You can just copy this one without the override.
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.
Fixed in 657f135
watchman/views.py
Outdated
|
||
return HttpResponse('pong', content_type='text/plain') | ||
return checks, 200 if ok else settings.WATCHMAN_ERROR_CODE, {WATCHMAN_VERSION_HEADER: __version__} |
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.
Would you mind pulling the http_code
out into it's own variable directly above? Just makes this line a bit easier to parse I think (same for in bare_status
).
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.
Fixed in 657f135
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.
@jamesmallen did this get pushed to this branch? I don't see the update on the PR.
Not sure if it's a Github issue or what.
I accidentally pushed to a different branch. Everything should be fixed (in the correct branch!) in 446c889 |
@jamesmallen Sorry, one more update if possible - could you update the sample project with the required configuration to make this endpoint available at |
If you’re not sure how to do this, let me know and I can take care of it. |
Sure thing. Added it in ae48537 |
Addresses #113