healthchecks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DEFAULT_GC_PAUSE_THRESHOLD = time.Duration(10) * time.Millisecond
)
View Source
const (
	DEFAULT_GR_THRESHOLD = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationHealthDetailed

type ApplicationHealthDetailed struct {
	Name         string        `json:"name,omitempty"`
	Status       bool          `json:"status"`
	Version      string        `json:"version,omitempty"`
	Date         string        `json:"date"`
	Duration     int64         `json:"duration"`
	Integrations []Integration `json:"integration,omitempty"`
}

type EnvChecker

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

func NewEnvChecker

func NewEnvChecker(envFilePath string) *EnvChecker

Used to check env file existed or not

func (*EnvChecker) Check

func (ec *EnvChecker) Check(name string) Integration

Check implements healthchecks.HealthCheckHandler.

type GarbageCollectionMaxChecker

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

func NewGarbageCollectionMaxChecker

func NewGarbageCollectionMaxChecker(threshold time.Duration) *GarbageCollectionMaxChecker

GCMaxPauseCheck returns a Check that fails if any recent Go garbage collection pause exceeds the provided threshold.

func (*GarbageCollectionMaxChecker) Check

Check implements HealthCheckHandler.

type GoroutineChecker

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

func NewGoroutineChecker

func NewGoroutineChecker(threshold int) *GoroutineChecker

func (*GoroutineChecker) Check

func (gr *GoroutineChecker) Check(name string) Integration

GoroutineCountCheck returns a Check that fails if too many goroutines are running (which could indicate a resource leak).

type HealthCheckHandler

type HealthCheckHandler interface {
	Check(name string) Integration
}

type HealthChecker

type HealthChecker interface {
	AddLivenessCheck(name string, check HealthCheckHandler)
	AddReadinessCheck(name string, check HealthCheckHandler)
	LivenessCheck() ApplicationHealthDetailed
	RedinessCheck() ApplicationHealthDetailed
}

func NewHealthChecker

func NewHealthChecker(name, version string) HealthChecker

type HealthCheckerApplication

type HealthCheckerApplication struct {
	Name    string
	Version string
	// contains filtered or unexported fields
}

func (*HealthCheckerApplication) AddLivenessCheck

func (app *HealthCheckerApplication) AddLivenessCheck(name string, check HealthCheckHandler)

AddLivenessCheck implements HealthChecker.

func (*HealthCheckerApplication) AddReadinessCheck

func (app *HealthCheckerApplication) AddReadinessCheck(name string, check HealthCheckHandler)

AddReadinessCheck implements HealthChecker.

func (*HealthCheckerApplication) LivenessCheck

LivenessCheck implements HealthChecker.

func (*HealthCheckerApplication) RedinessCheck

RedinessCheck implements HealthChecker.

type Integration

type Integration struct {
	Name         string `json:"name"`
	Status       bool   `json:"status"`
	ResponseTime int64  `json:"response_time"`
	URL          string `json:"url,omitempty"`
	Error        string `json:"error,omitempty"`
}

type Ping

type Ping struct {
	URL     string
	Method  string
	Timeout time.Duration

	Body    interface{}
	Headers map[string]string
	// contains filtered or unexported fields
}

func NewPingChecker

func NewPingChecker(URL, method string, timeout time.Duration, body interface{}, headers map[string]string) *Ping

NewPingChecker : time - millisecond

func (Ping) Check

func (p Ping) Check(name string) Integration

Jump to

Keyboard shortcuts

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