handler

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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

func (a *API) BumpHandler() http.Handler

BumpHandler handles POST/GET /heartbeat/{id}.

func (*API) FailHandler

func (a *API) FailHandler() http.Handler

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) Metrics

func (a *API) Metrics() http.Handler

Metrics exposes Prometheus metrics.

func (*API) PartialHandler

func (a *API) PartialHandler(
	siteRoot string,
) http.HandlerFunc

PartialHandler serves HTML snippets for dashboard sections: heartbeats, receivers, history.

func (*API) ReloadHandler

func (a *API) ReloadHandler() http.Handler

ReloadHandler triggers a config reload.

func (*API) TestHeartbeatHandler

func (a *API) TestHeartbeatHandler() http.Handler

TestHeartbeatHandler allows sending a test notification to a specific heartbeat

func (*API) TestReceiverHandler

func (a *API) TestReceiverHandler() http.Handler

TestReceiverHandler allows sending a test notification to a specific receiver

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL