[feature] Add healthcheck endpoints /livez and /readyz (#2783)

* [feature] Add healthcheck endpoints `/livez` and `/readyz`

* use select that returns no data
This commit is contained in:
tobi 2024-03-25 18:05:14 +01:00 committed by GitHub
commit b7b42e832a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 328 additions and 4 deletions

View file

@ -33,8 +33,8 @@ type Basic interface {
// If the database implementation doesn't need to be stopped, this can just return nil.
Close() error
// IsHealthy should return nil if the database connection is healthy, or an error if not.
IsHealthy(ctx context.Context) error
// Ready returns nil if the database connection is ready, or an error if not.
Ready(ctx context.Context) error
// GetByID gets one entry by its id. In a database like postgres, this might be the 'id' field of the entry,
// for other implementations (for example, in-memory) it might just be the key of a map.