@@ -20,6 +20,7 @@ import (
2020 "github.com/Masterminds/semver"
2121 "github.com/frikky/kin-openapi/openapi3"
2222 uuid "github.com/satori/go.uuid"
23+ "github.com/shuffle/opensearch-go/v4/opensearchapi"
2324)
2425
2526type appConfig struct {
@@ -723,6 +724,21 @@ func RunOpsHealthCheck(resp http.ResponseWriter, request *http.Request) {
723724 errorChannel <- err
724725 }()
725726
727+ if project .Environment != "cloud" {
728+ opensearchHealthChannel := make (chan opensearchapi.ClusterHealthResp )
729+ go func () {
730+ opensearchHealth , err := RunOpensearchOps (ctx )
731+ if err != nil {
732+ log .Printf ("[ERROR] Failed running opensearch health check: %s" , err )
733+ }
734+
735+ opensearchHealthChannel <- * opensearchHealth
736+ errorChannel <- err
737+ }()
738+
739+ platformHealth .OpensearchOps = <- opensearchHealthChannel
740+ }
741+
726742 // TODO: More testing for onprem health checks
727743 if project .Environment == "cloud" {
728744 openapiAppHealthChannel := make (chan AppHealth )
@@ -3431,6 +3447,20 @@ func HandleRerunExecutions(resp http.ResponseWriter, request *http.Request) {
34313447 resp .Write ([]byte (fmt .Sprintf (`{"success": true, "reason": "Successfully RERAN %d executions"}` , total )))
34323448}
34333449
3450+ func RunOpensearchOps (ctx context.Context ) (* opensearchapi.ClusterHealthResp , error ) {
3451+ if project .Environment == "cloud" {
3452+ return nil , errors .New ("Not running opensearch health check" )
3453+ }
3454+ req := opensearchapi.ClusterHealthReq {}
3455+ resp , err := project .Es .Cluster .Health (ctx , & req )
3456+ if err != nil {
3457+ log .Printf ("[ERROR] Failed to query cluster health: %s" , err )
3458+ return nil , err
3459+ }
3460+
3461+ return resp , nil
3462+ }
3463+
34343464// Send in deleteall=true to delete ALL executions for the environment ID
34353465func HandleStopExecutions (resp http.ResponseWriter , request * http.Request ) {
34363466 cors := HandleCors (resp , request )
0 commit comments