From 4b90ec9c8d08e1a9e5b216335678f9952534f71d Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Wed, 27 Sep 2023 12:48:35 -0400 Subject: [PATCH 1/2] chore: Return 502 from health endpoint on shutdown On shutdown, there will be a file at `/tmp/vroom.down`. When this file exists, it's a sign that the pod will shutdown. So return 502 from the health endpoint. --- cmd/vroom/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/vroom/main.go b/cmd/vroom/main.go index 48b8f2b..4d21b74 100644 --- a/cmd/vroom/main.go +++ b/cmd/vroom/main.go @@ -225,7 +225,11 @@ func main() { } func (e *environment) getHealth(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusNoContent) + if _, err := os.Stat("/tmp/vroom.down"); err == nil { + w.WriteHeader(http.StatusNoContent) + } else { + w.WriteHeader(http.StatusBadGateway) + } } type Filter struct { From 2d78a9e279a6f67d4d30be54d3dbecb93207dfde Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Wed, 27 Sep 2023 12:51:05 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0223484..97ff0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Rename the frame drop issue title. ([#315](https://github.com/getsentry/vroom/pull/315)) - Add new endpoint for regressed functions. ([#318](https://github.com/getsentry/vroom/pull/318)) +- Return 502 from health endpoint on shutdown. ([#323](https://github.com/getsentry/vroom/pull/323)) ## 23.9.1