mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 17:49:02 +08:00
chore: health endpoint related changes (#2275)
This commit is contained in:
parent
b0d5b15330
commit
995e45713c
@ -156,7 +156,7 @@ services:
|
||||
- TELEMETRY_ENABLED=true
|
||||
- DEPLOYMENT_TYPE=docker-swarm
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"]
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
@ -28,7 +28,7 @@ services:
|
||||
- "8080:8080"
|
||||
restart: on-failure
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"]
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
@ -174,7 +174,7 @@ services:
|
||||
- DEPLOYMENT_TYPE=docker-standalone-amd
|
||||
restart: on-failure
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"]
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
@ -1704,7 +1704,7 @@ func (aH *APIHandler) getHealth(w http.ResponseWriter, r *http.Request) {
|
||||
if ok {
|
||||
err := aH.reader.CheckClickHouse(r.Context())
|
||||
if err != nil {
|
||||
aH.HandleError(w, err, http.StatusServiceUnavailable)
|
||||
RespondError(w, &model.ApiError{Err: err, Typ: model.ErrorStatusServiceUnavailable}, nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -49,19 +49,20 @@ func (a *ApiError) IsNil() bool {
|
||||
type ErrorType string
|
||||
|
||||
const (
|
||||
ErrorNone ErrorType = ""
|
||||
ErrorTimeout ErrorType = "timeout"
|
||||
ErrorCanceled ErrorType = "canceled"
|
||||
ErrorExec ErrorType = "execution"
|
||||
ErrorBadData ErrorType = "bad_data"
|
||||
ErrorInternal ErrorType = "internal"
|
||||
ErrorUnavailable ErrorType = "unavailable"
|
||||
ErrorNotFound ErrorType = "not_found"
|
||||
ErrorNotImplemented ErrorType = "not_implemented"
|
||||
ErrorUnauthorized ErrorType = "unauthorized"
|
||||
ErrorForbidden ErrorType = "forbidden"
|
||||
ErrorConflict ErrorType = "conflict"
|
||||
ErrorStreamingNotSupported ErrorType = "streaming is not supported"
|
||||
ErrorNone ErrorType = ""
|
||||
ErrorTimeout ErrorType = "timeout"
|
||||
ErrorCanceled ErrorType = "canceled"
|
||||
ErrorExec ErrorType = "execution"
|
||||
ErrorBadData ErrorType = "bad_data"
|
||||
ErrorInternal ErrorType = "internal"
|
||||
ErrorUnavailable ErrorType = "unavailable"
|
||||
ErrorNotFound ErrorType = "not_found"
|
||||
ErrorNotImplemented ErrorType = "not_implemented"
|
||||
ErrorUnauthorized ErrorType = "unauthorized"
|
||||
ErrorForbidden ErrorType = "forbidden"
|
||||
ErrorConflict ErrorType = "conflict"
|
||||
ErrorStreamingNotSupported ErrorType = "streaming is not supported"
|
||||
ErrorStatusServiceUnavailable ErrorType = "service unavailable"
|
||||
)
|
||||
|
||||
// BadRequest returns a ApiError object of bad request
|
||||
|
@ -6,7 +6,7 @@ func IgnoredPaths() map[string]struct{} {
|
||||
"/api/v1/version": {},
|
||||
"/api/v1/query_range": {},
|
||||
"/api/v2/metrics/query_range": {},
|
||||
"/api/v1/services/list": {},
|
||||
"/api/v1/health": {},
|
||||
}
|
||||
|
||||
return ignoredPaths
|
||||
|
@ -90,7 +90,7 @@ func startCluster() error {
|
||||
|
||||
client := http.Client{}
|
||||
for i := 0; i < 10; i++ {
|
||||
if _, err := client.Get("http://localhost:8180/api/v1/version"); err != nil {
|
||||
if _, err := client.Get("http://localhost:8180/api/v1/health"); err != nil {
|
||||
time.Sleep(2 * time.Second)
|
||||
} else {
|
||||
log.Printf("CLUSTER UP\n")
|
||||
|
@ -162,7 +162,7 @@ services:
|
||||
- DEPLOYMENT_TYPE=docker-standalone-amd
|
||||
restart: on-failure
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/version"]
|
||||
test: ["CMD", "wget", "--spider", "-q", "localhost:8080/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user