-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from MZC-CSC/develop
Update readyz API to check database connection and subsystem readiness
- Loading branch information
Showing
23 changed files
with
621 additions
and
423 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ meta/*.db | |
ant | ||
data | ||
conf | ||
container-volume | ||
container-volume | ||
./bin/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package app | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/labstack/echo/v4" | ||
) | ||
|
||
// @Id AntServerReadiness | ||
// @Summary Check CB-Ant API server readiness | ||
// @Description This endpoint checks if the CB-Ant API server is ready by verifying the status of both the load service and the cost service. If either service is unavailable, it returns a 503 status indicating the server is not ready. | ||
// @Tags [Server Health] | ||
// @Accept json | ||
// @Produce json | ||
// @Success 200 {object} map[string]string "CM-Ant API server is ready" | ||
// @Failure 503 {object} map[string]string "CB-Ant API server is not ready" | ||
// @Router /readyz [get] | ||
func (s *AntServer) readyz(c echo.Context) error { | ||
err := s.services.loadService.Readyz() | ||
if err != nil { | ||
return echo.NewHTTPError(http.StatusServiceUnavailable, map[string]string{ | ||
"message": "CM-Ant API server is not ready", | ||
}) | ||
} | ||
|
||
err = s.services.costService.Readyz() | ||
|
||
if err != nil { | ||
return echo.NewHTTPError(http.StatusServiceUnavailable, map[string]string{ | ||
"message": "CM-Ant API server is not ready", | ||
}) | ||
} | ||
|
||
return c.JSON(http.StatusOK, map[string]string{ | ||
"message": "CM-Ant API server is ready", | ||
}) | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.