Skip to content

Add healthcheck handler#68

Closed
isaacd9 wants to merge 1 commit intoriverqueue:masterfrom
isaacd9:isaac/healthcheck
Closed

Add healthcheck handler#68
isaacd9 wants to merge 1 commit intoriverqueue:masterfrom
isaacd9:isaac/healthcheck

Conversation

@isaacd9
Copy link

@isaacd9 isaacd9 commented Jun 26, 2024

Add a Healthcheck handler at /healthcheck.

Closes #67

@brandur brandur self-assigned this Jun 28, 2024
@brandur
Copy link
Collaborator

brandur commented Jun 28, 2024

@isaacd9 Thank you!

Do you mind if I take this one over? I just brought in a small API framework in #63, and we're starting to write more tests for new endpoints. I also want to follow this pattern [1] of two separate health check endpoints, one of which will ping the database to make sure it's also healthy. Basic health check endpoints are useful in some cases like where a proxy might want to it to check liveness, but the app could be totally non-functional because the DB is down and a basic health check would still be reading as healthy.

[1] https://brandur.org/fragments/database-health-check

brandur added a commit that referenced this pull request Jun 28, 2024
…abase

An alternative to #68 that adds a pair of health check endpoints:

* `GET /api/health-checks/complete`
* `GET /api/health-checks/minimal`

The minimal endpoint just returns an OK response regardless of anything
else so it'll return 200 as long as the Go process is up. The complete
endpoint runs the additional check of pinging the database, verifying
its liveliness as well. This is useful because if the database is
totally down then River UI will be totally non-functional, but the
minimal endpoint would still return OK, and it's nice to have an
alternative that'll return an unhealthy status. Based on something I
wrote about last year here [1].

[1] https://brandur.org/fragments/database-health-check
brandur added a commit that referenced this pull request Jun 28, 2024
…abase

An alternative to #68 that adds a pair of health check endpoints:

* `GET /api/health-checks/complete`
* `GET /api/health-checks/minimal`

The minimal endpoint just returns an OK response regardless of anything
else so it'll return 200 as long as the Go process is up. The complete
endpoint runs the additional check of pinging the database, verifying
its liveliness as well. This is useful because if the database is
totally down then River UI will be totally non-functional, but the
minimal endpoint would still return OK, and it's nice to have an
alternative that'll return an unhealthy status. Based on something I
wrote about last year here [1].

Fixes #67.

[1] https://brandur.org/fragments/database-health-check
@brandur
Copy link
Collaborator

brandur commented Jun 28, 2024

Pitched up #72 as an alternative.

@isaacd9 isaacd9 closed this Jun 28, 2024
brandur added a commit that referenced this pull request Jun 28, 2024
…abase (#72)

An alternative to #68 that adds a pair of health check endpoints:

* `GET /api/health-checks/complete`
* `GET /api/health-checks/minimal`

The minimal endpoint just returns an OK response regardless of anything
else so it'll return 200 as long as the Go process is up. The complete
endpoint runs the additional check of pinging the database, verifying
its liveliness as well. This is useful because if the database is
totally down then River UI will be totally non-functional, but the
minimal endpoint would still return OK, and it's nice to have an
alternative that'll return an unhealthy status. Based on something I
wrote about last year here [1].

Fixes #67.

[1] https://brandur.org/fragments/database-health-check

---------

Co-authored-by: Isaac Diamond <isaac@meter.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add healthcheck route

2 participants