Documentation
¶
Index ¶
- func GetStats(store *lib.InitStore) fiber.Handler
- func Handler(version string, releaseID string, serviceID string, checkers []Checker, ...) fiber.Handler
- func Init(store *lib.InitStore)
- func LiveHandler() fiber.Handler
- func ReadyHandler(state *lifecycle.State, db Checker) fiber.Handler
- type Check
- type Checker
- type ClusterChecker
- type ClusterObservation
- type DBChecker
- type EtherpadChecker
- type HealthResponse
- type HealthStatus
- type StatsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStats ¶ added in v0.6.3
GetStats godoc @Summary Instance statistics @Description Returns the total number of pads, connected sessions and pads with connected users @Tags Stats @Produce json @Success 200 {object} StatsResponse @Failure 500 {object} errors.Error @Security BearerAuth @Router /admin/api/stats [get]
func Handler ¶
func Handler( version string, releaseID string, serviceID string, checkers []Checker, detailed bool, ) fiber.Handler
Handler godoc @Summary Health check endpoint @Description Returns the health status of the service (RFC Health Check Draft) @Tags Health @Produce json @Success 200 {object} HealthResponse "Service is healthy" @Failure 503 {object} HealthResponse "Service is unhealthy" @Router /health [get]
With detailed false (the public /health, as in etherpad-lite) only status and releaseId are answered, with the same HTTP status: the checks name active pads, cluster members and database errors, which anonymous clients must not read. The admin API serves the detailed answer.
func LiveHandler ¶ added in v0.7.0
LiveHandler answers the liveness probe: the process serves requests. It checks nothing else, so a database outage does not get every pod restarted at once.
Types ¶
type Check ¶
type Check struct {
Status HealthStatus `json:"status" example:"pass"`
Component string `json:"component,omitempty" example:"database"`
Observed any `json:"observedValue,omitempty"`
ObservedAt string `json:"observedAt,omitempty" example:"2024-01-15T10:30:00Z"`
Output string `json:"output,omitempty" example:"ok"`
}
Check represents the result of a single health check @Description Result of a health check
type ClusterChecker ¶ added in v0.7.0
ClusterChecker reports how this instance sees the cluster. A missing bus is only a warning: edits stay correct through the database, other instances just see them later.
func (ClusterChecker) Check ¶ added in v0.7.0
func (c ClusterChecker) Check() Check
func (ClusterChecker) Name ¶ added in v0.7.0
func (c ClusterChecker) Name() string
type ClusterObservation ¶ added in v0.7.0
type ClusterObservation struct {
Enabled bool `json:"enabled"`
Members int `json:"members"`
RetentionLeader bool `json:"retentionLeader"`
}
ClusterObservation is the observedValue of the cluster check.
type EtherpadChecker ¶
type EtherpadChecker struct {
// contains filtered or unexported fields
}
func (EtherpadChecker) Check ¶
func (e EtherpadChecker) Check() Check
func (EtherpadChecker) Name ¶
func (e EtherpadChecker) Name() string
type HealthResponse ¶
type HealthResponse struct {
Status HealthStatus `json:"status" example:"pass"`
Version string `json:"version,omitempty" example:"1.0.0"`
ReleaseID string `json:"releaseId,omitempty" example:"abc123"`
ServiceID string `json:"serviceId,omitempty" example:"etherpad-api"`
Checks map[string][]Check `json:"checks,omitempty"`
}
HealthResponse represents the response of the health endpoint @Description Complete health check response
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the status of a health check @Description Status of a health check (pass, warn, fail)
const ( StatusPass HealthStatus = "pass" StatusWarn HealthStatus = "warn" StatusFail HealthStatus = "fail" )
type StatsResponse ¶ added in v0.6.3
type StatsResponse struct {
TotalPads int `json:"totalPads"`
TotalSessions int `json:"totalSessions"`
TotalActivePads int `json:"totalActivePads"`
}
StatsResponse mirrors the original getStats API payload.