handler

package
v0.22.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SPA added in v0.22.0

func SPA(spaFS fs.FS, routePrefix string) http.HandlerFunc

SPA serves the built React bundle from frontend/dist.

Types

type API

type API struct {
	Version string       // Build version string.
	Commit  string       // Build commit string.
	SiteURL string       // Site root URL.
	Logger  *slog.Logger // Logger for access/system logs.
	// contains filtered or unexported fields
}

API bundles shared handler dependencies and runtime configuration.

func NewAPI

func NewAPI(
	version, commit string,
	siteURL string,
	logger *slog.Logger,
) *API

NewAPI builds an API container with shared handler dependencies.

func (*API) Config added in v0.22.0

func (a *API) Config() http.HandlerFunc

Config returns runtime configuration for the SPA.

func (*API) Healthz

func (a *API) Healthz() http.HandlerFunc

Healthz returns the HTTP handler for the /healthz endpoint.

func (*API) Heartbeat added in v0.22.0

func (a *API) Heartbeat() http.HandlerFunc

Heartbeat receives heartbeat pings for a specific heartbeat id.

func (*API) HeartbeatsSum added in v0.22.0

func (a *API) HeartbeatsSum() http.HandlerFunc

Heartbeats returns a list of configured heartbeats for the UI.

func (*API) HistoryAll added in v0.22.0

func (a *API) HistoryAll() http.HandlerFunc

HistoryAll returns all recorded history items.

func (*API) HistoryByHeartbeat added in v0.22.0

func (a *API) HistoryByHeartbeat() http.HandlerFunc

HistoryByHeartbeat returns recorded history items filtered by heartbeat id.

func (*API) HistoryRecorder added in v0.22.0

func (a *API) HistoryRecorder() history.Recorder

HistoryRecorder returns the configured history recorder.

func (*API) Metrics

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

Metrics exposes Prometheus metrics.

func (*API) ReceiversSum added in v0.22.0

func (a *API) ReceiversSum() http.HandlerFunc

Receivers returns a list of receivers for the UI.

func (*API) ReloadHandler

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

ReloadHandler triggers a config reload.

func (*API) SetHistory added in v0.22.0

func (a *API) SetHistory(h history.Recorder)

SetHistory attaches a history recorder

func (*API) SetHub added in v0.22.0

func (a *API) SetHub(hub *ws.Hub)

SetHub attaches a websocket hub to the API.

func (*API) SetMetrics added in v0.22.0

func (a *API) SetMetrics(m *metrics.Registry)

SetMetrics attaches a metrics registry

func (*API) SetReloadFn added in v0.22.0

func (a *API) SetReloadFn(fn func() error)

SetReloadFn attaches a reload function to the API.

func (*API) SetService added in v0.22.0

func (a *API) SetService(s ServiceProvider)

SetService attaches a heartbeat service

func (*API) Status added in v0.22.0

func (a *API) Status() http.HandlerFunc

Status returns a status snapshot of the heartbeat receiver.

func (*API) StatusAll added in v0.22.0

func (a *API) StatusAll() http.HandlerFunc

Status returns a status snapshot of the heartbeat receiver.

func (*API) WS added in v0.22.0

func (a *API) WS() http.HandlerFunc

WS streams heartbeat updates over a websocket connection.

type ServiceProvider added in v0.22.0

type ServiceProvider interface {
	HeartbeatSummaries() []service.HeartbeatSummary
	ReceiverSummaries() []service.ReceiverSummary
	Update(id string, payload string, now time.Time) error
	StatusAll() []service.Status
	StatusByID(id string) (service.Status, error)
}

ServiceProvider exposes the subset of the heartbeat service used by handlers.

Jump to

Keyboard shortcuts

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