Skip to content

Commit 8a7b6fd

Browse files
adrien-fbwplotka
authored andcommitted
Add /-/healthy endpoint to Querier (thanos-io#574)
Signed-off-by: Adrien Fillon <adrien.fillon@cdiscount.com>
1 parent d3fb337 commit 8a7b6fd

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
3333
- `thanos rule` now supports static configuration of query nodes via `--query`
3434
- `thanos rule` now supports file based discovery of query nodes using `--query.file-sd-config.files`
3535
- `thanos query` now supports file based discovery of store nodes using `--store.file-sd-config.files`
36+
- Add `/-/healthy` endpoint to Querier.
3637

3738
### Fixed
3839
- [#566](https://github.com/improbable-eng/thanos/issues/566) - Fixed issue whereby the Proxy Store could end up in a deadlock if there were more than 9 stores being queried and all returned an error.

cmd/thanos/query.go

+7
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ func runQuery(
366366
api := v1.NewAPI(logger, reg, engine, queryableCreator, enableAutodownsampling)
367367
api.Register(router.WithPrefix("/api/v1"), tracer, logger)
368368

369+
router.Get("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
370+
w.WriteHeader(http.StatusOK)
371+
if _, err := fmt.Fprintf(w, "Thanos Querier is Healthy.\n"); err != nil {
372+
level.Error(logger).Log("msg", "Could not write health check response.")
373+
}
374+
})
375+
369376
mux := http.NewServeMux()
370377
registerMetrics(mux, reg)
371378
registerProfile(mux)

kube/manifests/thanos-query.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ spec:
3636
containerPort: 10901
3737
- name: cluster
3838
containerPort: 10900
39+
livenessProbe:
40+
httpGet:
41+
path: /-/healthy
42+
port: http
3943
---
4044
apiVersion: v1
4145
kind: Service

0 commit comments

Comments
 (0)