health

package
v0.0.0-...-58c0a64 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	// contains filtered or unexported methods
}

Checker interface for health

func NewBrokerHealthChecker

func NewBrokerHealthChecker(admin messagebroker.Admin) Checker

NewBrokerHealthChecker returns a broker health checker

func NewCacheHealthChecker

func NewCacheHealthChecker(cache cache.ICache) Checker

NewCacheHealthChecker returns a cache health checker

func NewRegistryHealthChecker

func NewRegistryHealthChecker(registry registry.IRegistry) Checker

NewRegistryHealthChecker returns a registry health checker

type Core

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

Core holds business logic and/or orchestrator of other things in the package.

func (*Core) IsHealthy

func (c *Core) IsHealthy(ctx context.Context) bool

IsHealthy checks if the app has been marked unhealthy. If so it'll return false. Otherwise, it'll check the application health and return a boolean value based on the health check result.

func (*Core) MarkUnhealthy

func (c *Core) MarkUnhealthy()

MarkUnhealthy marks the core as unhealthy. Any further health checks after marking unhealthy will fail.

type ICore

type ICore interface {
	IsHealthy(ctx context.Context) bool
	MarkUnhealthy()
}

ICore is an interface over health core

func NewCore

func NewCore(checkers ...Checker) (ICore, error)

NewCore creates a new health core.

type Server

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

Server has methods implementing of server rpc.

func NewServer

func NewServer(core ICore) *Server

NewServer returns a health server

func (*Server) Check

Check returns service's serving status.

func (*Server) LivenessCheck

func (h *Server) LivenessCheck(ctx context.Context, _ *emptypb.Empty) (*metrov1.StatusCheckResponse, error)

LivenessCheck checks responsiveness of all the dependant resources that the service is using

func (*Server) ReadinessCheck

func (h *Server) ReadinessCheck(ctx context.Context, _ *emptypb.Empty) (*metrov1.StatusCheckResponse, error)

ReadinessCheck checks only for the responsiveness of the service

Jump to

Keyboard shortcuts

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