stats

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(
	version string,
	releaseID string,
	serviceID string,
	checkers []Checker,
) 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]

func Init

func Init(store *lib.InitStore)

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 Checker

type Checker interface {
	Name() string
	Check() Check
}

Checker is the interface for health check implementations

type DBChecker

type DBChecker struct {
	// contains filtered or unexported fields
}

func (DBChecker) Check

func (d DBChecker) Check() Check

func (DBChecker) Name

func (d DBChecker) Name() string

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

Jump to

Keyboard shortcuts

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