-
Notifications
You must be signed in to change notification settings - Fork 429
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
feat: Switch existing task processor health checks to new liveness probe #5161
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bf0ad04
feat: Switch existing task processor health checks to new liveness probe
khvn26 701ba0d
improve coverage, add deprecation warning
khvn26 4897c55
Remove legacy healthcheck from Compose, use new check in Dockerfile
rolodato 6177b09
Add curl to API runtime Docker image
rolodato dfeb86e
use task processor with server
khvn26 f8b99c4
huh?
khvn26 438a0a7
fix entrypoint
khvn26 a72b7e1
fix coverage
khvn26 afb3ba5
update docs
khvn26 ef84c90
switch to released task-processor
khvn26 149033a
bump task-processor to 1.3.1
khvn26 ac086b4
improve deprecated health check warning
khvn26 e9e5a41
Merge branch 'main' into feat/adapt-removed-task-processor-health-cmd
khvn26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import logging | ||
import sys | ||
|
||
import requests | ||
|
||
url = "http://localhost:8000/health/liveness" | ||
status = requests.get(url).status_code | ||
HEALTH_LIVENESS_URL = "http://localhost:8000/health/liveness" | ||
|
||
sys.exit(0 if 200 >= status < 300 else 1) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def main() -> None: | ||
logger.warning( | ||
f"This healthcheck, invoked by {' '.join(sys.argv)}, is deprecated. " | ||
f"Use the `{HEALTH_LIVENESS_URL}` endpoint instead." | ||
) | ||
status_code = requests.get(HEALTH_LIVENESS_URL).status_code | ||
|
||
if status_code != 200: | ||
logger.error(f"Health check failed with status {status_code}") | ||
|
||
sys.exit(0 if 200 >= status_code < 300 else 1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we add a deprecation warning when this is being used? In case we need to troubleshoot other customer deployments that have similar issues, this could tell us immediately if they are using the old style healthchecks or not.
I understand this code is only ever called by Docker Compose healthchecks, which should be removed.
Otherwise LGTM 👍
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.
Done.
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.
I am slightly concerned with the deprecation warning that's been added here since, if I understand correctly, anyone invoking
python manage.py checktaskprocessorthreadhealth
will also see this confusing deprecation warning.I think that could be anyone who explicitly uses the management command, but more likely anyone that updates the flagsmith version without updating their chart 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.
Valid point. I've reworked the warning to be more descriptive.