health

package
v0.0.0-...-c11a323 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	Host      string        `json:"host"`
	StartedAt time.Time     `json:"startedAt"`
	Uptime    time.Duration `json:"uptime"`
	Version   string        `json:"version"`
}

Common is a common health status report contained in both liveness and readiness reports.

func NewCommon

func NewCommon(startedAt time.Time, version string) Common

type Component

type Component interface {
	Identifier() string
	Check(context.Context) *ComponentStatus
}

type ComponentStatus

type ComponentStatus struct {
	Identifier string `json:"identifier"`
	Healthy    bool   `json:"healthy"`
	Error      string `json:"error,omitempty"`
}

type Interface

type Interface interface {
	Liveness(ctx context.Context) *LivenessStatus
	Readiness(ctx context.Context) *ReadinessStatus
}

type LivenessStatus

type LivenessStatus struct {
	Common
	Healthy bool `json:"healthy"`
}

func NewLivenessStatus

func NewLivenessStatus(startedAt time.Time, version string) *LivenessStatus

NewLivenessStatus creates a new liveness status report.

type PostgresComponent

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

func NewPostgresComponent

func NewPostgresComponent(pool *pgxpool.Pool) *PostgresComponent

func (*PostgresComponent) Check

func (*PostgresComponent) Identifier

func (c *PostgresComponent) Identifier() string

type ReadinessStatus

type ReadinessStatus struct {
	Common
	Healthy           bool               `json:"healthy"`
	ComponentStatuses []*ComponentStatus `json:"componentStatuses"`
}

func NewReadinessStatus

func NewReadinessStatus(startedAt time.Time, version string, componentStatuses []*ComponentStatus) *ReadinessStatus

NewReadinessStatus creates a new aggregated readiness status report.

type Service

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

func New

func New(version string, components ...Component) *Service

func (*Service) Liveness

func (h *Service) Liveness(ctx context.Context) *LivenessStatus

Liveness returns the liveness status of the application indicating if the application is running.

func (*Service) Readiness

func (h *Service) Readiness(ctx context.Context) *ReadinessStatus

Readiness returns the readiness status of the application indicating if the application is ready to serve requests.

type YunikornComponent

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

func NewYunikornComponent

func NewYunikornComponent(client yunikorn.Client) *YunikornComponent

func (*YunikornComponent) Check

func (*YunikornComponent) Identifier

func (c *YunikornComponent) Identifier() string

Jump to

Keyboard shortcuts

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