Skip to content

Commit

Permalink
add log if health check failed
Browse files Browse the repository at this point in the history
  • Loading branch information
chengjoey committed Sep 10, 2021
1 parent 23336b0 commit c02c5bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/pipeline/endpoints/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"context"
"net/http"

"github.com/sirupsen/logrus"

"github.com/erda-project/erda/modules/pipeline/services/apierrors"
"github.com/erda-project/erda/pkg/http/httpserver"
)
Expand All @@ -25,6 +27,7 @@ func (e *Endpoints) healthCheck(ctx context.Context, r *http.Request, vars map[s
httpserver.Responser, error) {
_, err := e.dbClient.Exec("select 1")
if err != nil {
logrus.Errorf("failed to health check, err: %v", err)
return apierrors.ErrPipelineHealthCheck.InternalError(err).ToResp(), nil
}
return httpserver.OkResp("success")
Expand Down

0 comments on commit c02c5bf

Please sign in to comment.