Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: health endpoint related changes (#2275)

Prashant Shahi995e45713cb1
diff --git a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
index bee9c700f5..761cf9a589 100644
--- a/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
+++ b/deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
@@ -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
diff --git a/deploy/docker/clickhouse-setup/docker-compose-local.yaml b/deploy/docker/clickhouse-setup/docker-compose-local.yaml
index d5747c8e9d..b4c7cfca7e 100644
--- a/deploy/docker/clickhouse-setup/docker-compose-local.yaml
+++ b/deploy/docker/clickhouse-setup/docker-compose-local.yaml
@@ -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
diff --git a/deploy/docker/clickhouse-setup/docker-compose.yaml b/deploy/docker/clickhouse-setup/docker-compose.yaml
index 37bc2c40c1..b3fd9c242a 100644
--- a/deploy/docker/clickhouse-setup/docker-compose.yaml
+++ b/deploy/docker/clickhouse-setup/docker-compose.yaml
@@ -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
diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.go
index 130d11e368..06de321612 100644
--- a/pkg/query-service/app/http_handler.go
+++ b/pkg/query-service/app/http_handler.go
@@ -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
}
}
diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.go
index 8aa815bc19..716f09f91b 100644
--- a/pkg/query-service/model/response.go
+++ b/pkg/query-service/model/response.go
@@ -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
diff --git a/pkg/query-service/telemetry/ignored.go b/pkg/query-service/telemetry/ignored.go
index e0faad4461..6ffacba848 100644
--- a/pkg/query-service/telemetry/ignored.go
+++ b/pkg/query-service/telemetry/ignored.go
@@ -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
diff --git a/pkg/query-service/tests/docker.go b/pkg/query-service/tests/docker.go
index da2c07f775..a710161a0e 100644
--- a/pkg/query-service/tests/docker.go
+++ b/pkg/query-service/tests/docker.go
@@ -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")
diff --git a/pkg/query-service/tests/test-deploy/docker-compose.yaml b/pkg/query-service/tests/test-deploy/docker-compose.yaml
index 3bde538611..e604a12c05 100644
--- a/pkg/query-service/tests/test-deploy/docker-compose.yaml
+++ b/pkg/query-service/tests/test-deploy/docker-compose.yaml
@@ -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