Documentation
¶
Index ¶
- type API
- func (a *API) BumpHandler() http.Handler
- func (a *API) FailHandler() http.Handler
- func (a *API) Healthz(service *health.Service) http.HandlerFunc
- func (a *API) HomeHandler() http.HandlerFunc
- func (a *API) Metrics() http.Handler
- func (a *API) PartialHandler(siteRoot string) http.HandlerFunc
- func (a *API) ReloadHandler() http.Handler
- func (a *API) TestHeartbeatHandler() http.Handler
- func (a *API) TestReceiverHandler() http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Version string // Version is the build version string.
Commit string // Commit is the build commit SHA.
SiteRoot string
RoutePrefix string
Debug bool
Logger *slog.Logger
// contains filtered or unexported fields
}
API bundles shared handler dependencies and runtime configuration.
func NewAPI ¶
func NewAPI( version, commit string, webFS fs.FS, siteRoot string, routePrefix string, debug bool, logger *slog.Logger, mgr *heartbeat.Manager, hist history.Store, rec *servicehistory.Recorder, disp *notifier.Dispatcher, metricsReg *metrics.Registry, configReloadFn func() error, ) *API
NewAPI builds a handler container with shared dependencies.
func (*API) BumpHandler ¶
BumpHandler handles POST/GET /heartbeat/{id}.
func (*API) FailHandler ¶
FailHandler handles POST/GET /heartbeat/{id}/fail.
func (*API) Healthz ¶
func (a *API) Healthz(service *health.Service) http.HandlerFunc
Healthz returns the HTTP handler for the /healthz endpoint.
func (*API) HomeHandler ¶
func (a *API) HomeHandler() http.HandlerFunc
HomeHandler renders the base template with navbar and footer.
func (*API) PartialHandler ¶
func (a *API) PartialHandler( siteRoot string, ) http.HandlerFunc
PartialHandler serves HTML snippets for dashboard sections: heartbeats, receivers, history.
func (*API) ReloadHandler ¶
ReloadHandler triggers a config reload.
func (*API) TestHeartbeatHandler ¶
TestHeartbeatHandler allows sending a test notification to a specific heartbeat
func (*API) TestReceiverHandler ¶
TestReceiverHandler allows sending a test notification to a specific receiver