{"record":{"id":"a65aa2406dad7261","repo":"thanos-io/thanos","slug":"not-ok","errorCode":null,"errorMessage":"NOT OK","messagePattern":"NOT OK","errorType":"http","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"pkg/prober/http.go","lineNumber":41,"sourceCode":"// NewHTTP returns HTTPProbe representing readiness and healthiness of given component.\nfunc NewHTTP() *HTTPProbe {\n\treturn &HTTPProbe{}\n}\n\n// HealthyHandler returns a HTTP Handler which responds health checks.\nfunc (p *HTTPProbe) HealthyHandler(logger log.Logger) http.HandlerFunc {\n\treturn p.handler(logger, p.isHealthy)\n}\n\n// ReadyHandler returns a HTTP Handler which responds readiness checks.\nfunc (p *HTTPProbe) ReadyHandler(logger log.Logger) http.HandlerFunc {\n\treturn p.handler(logger, p.IsReady)\n}\n\nfunc (p *HTTPProbe) handler(logger log.Logger, c check) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, _ *http.Request) {\n\t\tif !c() {\n\t\t\thttp.Error(w, \"NOT OK\", http.StatusServiceUnavailable)\n\t\t\treturn\n\t\t}\n\t\tif _, err := io.WriteString(w, \"OK\"); err != nil {\n\t\t\tlevel.Error(logger).Log(\"msg\", \"failed to write probe response\", \"err\", err)\n\t\t}\n\t}\n}\n\n// IsReady returns true if component is ready.\nfunc (p *HTTPProbe) IsReady() bool {\n\tready := p.ready.Load()\n\treturn ready > 0\n}\n\n// isHealthy returns true if component is healthy.\nfunc (p *HTTPProbe) isHealthy() bool {\n\thealthy := p.healthy.Load()\n\treturn healthy > 0","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/prober/http.go#L23-L59","documentation":"The HTTP probe handler writes the literal body \"NOT OK\" with HTTP 503 Service Unavailable when the readiness check function returns false. It is not a Go error; it is the readiness endpoint's failure response, meaning the process (e.g. Thanos component) is not ready to serve traffic.","triggerScenarios":"GET to the /-/ready (probe) endpoint while p.IsReady returns false — the component has not finished startup or has been marked not ready.","commonSituations":"Kubernetes readiness probes failing during slow startup (index loading, store sync); orchestrator rerouting traffic away from a warming-up instance; monitoring alerting on 503s from /-/ready.","solutions":["Wait for the component to complete startup; check startup logs for readiness progress","Increase the readiness probe's initialDelaySeconds/failureThreshold in Kubernetes","If permanently not-ready, investigate the blocking dependency (storage, Prometheus, peers)","Use the /-/healthy liveness endpoint to distinguish liveness from readiness"],"exampleFix":"// kubernetes probe tuning\n// before\nreadinessProbe: { httpGet: { path: /-/ready }, failureThreshold: 3 }\n// after\nreadinessProbe: { httpGet: { path: /-/ready }, initialDelaySeconds: 30, periodSeconds: 10, failureThreshold: 12 }","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// orchestrator-side: tolerate transient 503 from /-/ready\nif resp.StatusCode == http.StatusServiceUnavailable {\n    time.Sleep(10 * time.Second)\n    // re-probe; only alert after sustained failures\n}","preventionTips":["Give readiness probes generous initialDelay and failureThreshold","Distinguish liveness (/-/healthy) from readiness (/-/ready) in probe config","Monitor startup logs to tune expected warm-up time"],"tags":["http","readiness","kubernetes"],"backgroundTag":"http-error-response","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}