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