forked from mtusi2026/mtusi2026lab6
feat: add bounded observability and verified SLO incident alerts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package fiber
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"gitea.privcloud.tech/vlad_marlo/mtusi2026lab6/internal/service"
|
||||
)
|
||||
|
||||
// handleLive reports that the server process is running.
|
||||
func (ctrl *Controller) handleLive(ctx *fiber.Ctx) error {
|
||||
return ctx.JSON(fiber.Map{"status": "ok"})
|
||||
}
|
||||
|
||||
// handleReady reports readiness unless shutdown has started.
|
||||
func (ctrl *Controller) handleReady(ctx *fiber.Ctx) error {
|
||||
if ctrl.stopping.Load() {
|
||||
return errBusy
|
||||
}
|
||||
if err := ctrl.readiness.Ping(ctx.UserContext()); err != nil {
|
||||
return errBusy
|
||||
}
|
||||
return ctrl.handleLive(ctx)
|
||||
}
|
||||
|
||||
// handleNotFound returns the application error for an unmatched route.
|
||||
func (ctrl *Controller) handleNotFound(_ *fiber.Ctx) error {
|
||||
return service.ErrNotFound
|
||||
}
|
||||
Reference in New Issue
Block a user