Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

659 Add Postgres and Redis to health endpoint #690

Merged
merged 10 commits into from
Jun 22, 2022

Conversation

eastandwestwind
Copy link
Contributor

@eastandwestwind eastandwestwind commented Jun 21, 2022

Purpose

Adds Postgres and Redis health checks to health endpoint.

Changes

  • Return status of Postgres (including any migrations needed) and Redis to health endpoint
  • Suppresses alembic and sqlalchemy logs for health endpoint

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #659

@seanpreston seanpreston self-assigned this Jun 22, 2022
def health_check() -> Dict[str, bool]:

@router.get(HEALTH, response_model=Dict[str, Union[bool, str]])
def health_check() -> Dict[str, Union[bool, str]]:
return {
"healthy": True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if we could change this response to "webserver": "healthy" to standardise the format across the services. Or alternatively something like:

{
  "healthy": True,
  "db": {
    "healthy": True
  },
  "cache": {
    "healthy": True
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, I've updated to "webserver": "healthy"

Copy link
Contributor

@seanpreston seanpreston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor ask to standardise the formats in the response, aside from that this is great

@seanpreston seanpreston merged commit ba28896 into main Jun 22, 2022
@seanpreston seanpreston deleted the 659-add-db-redis-health-endpoint branch June 22, 2022 20:13
sanders41 pushed a commit that referenced this pull request Sep 22, 2022
* adds db and redis to health endpoint, untested

* updates typing, suppresses sqlalchemy and alembic logs for healthchecks

* adds to makefile, updates docs and tests

* format

* adds check for cache enabled, update tests

* format

* standardize health endpoint structure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the webserver to run healthchecks - add to health endpoint
2 participants