healthcheck

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Redis     = "redis"
	Memcached = "memcached"
	Web       = "web"
	Custom    = "custom"
)

Mapped types for IntegrationConfig

View Source
const (
	RedisIntegration       = "Redis DB"
	MemcachedIntegration   = "Memcached DB"
	WebServiceIntegration  = "Web service API"
	CustomizedTestFunction = "Customized test function"
)

Mapped typs for kinds of integrations

Variables

This section is empty.

Functions

func CheckCustom added in v1.7.0

func CheckCustom(config IntegrationConfig, result *ApplicationHealthDetailed, wg *sync.WaitGroup, checklist chan Integration)

Types

type ApplicationConfig added in v1.0.2

type ApplicationConfig struct {
	Name         string              `json:"name"`
	Version      string              `json:"version"`
	Integrations []IntegrationConfig `json:"integrations"`
}

ApplicationConfig is a config contract to init health caller

type ApplicationHealthDetailed added in v1.0.2

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

ApplicationHealthDetailed used to check all application integrations and return status of each of then

func HealthCheckerDetailed added in v1.0.2

func HealthCheckerDetailed(config ApplicationConfig) ApplicationHealthDetailed

HealthCheckerDetailed perform a check for every integration informed

type ApplicationHealthSimple added in v1.0.2

type ApplicationHealthSimple struct {
	Status string `json:"status"`
}

ApplicationHealthSimple used to simple return a string 'OK'

func HealthCheckerSimple added in v1.0.2

func HealthCheckerSimple() ApplicationHealthSimple

HealthCheckerSimple performs a simple check of the application

type Auth added in v1.0.2

type Auth struct {
	User     string
	Password string
}

Auth is a default struct to map user/pass protocol

type HTTPHeader added in v1.0.2

type HTTPHeader struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"Value,omitempty"`
}

HTTPHeader used to setup webservices integrations

type Integration added in v1.0.2

type Integration struct {
	Name         string  `json:"name"`
	Kind         string  `json:"kind"`
	Status       bool    `json:"status"`
	ResponseTime float64 `json:"response_time"` //in seconds
	URL          string  `json:"url"`
	Error        string  `json:"error,omitempty"` // error.Error()
}

Integration is the type result for requests

type IntegrationConfig added in v1.0.2

type IntegrationConfig struct {
	Type    string       `json:"Type"` // must be web | redis | memcache
	Name    string       `json:"name"`
	Host    string       `json:"host"` // yes you can concat host:port here
	Port    string       `json:"port,omitempty"`
	Headers []HTTPHeader `json:"headers,omitempty"`
	DB      int          `json:"db,omitempty"`      // default value is 0
	TimeOut int          `json:"timeout,omitempty"` // default value: 10
	Auth    Auth         `json:"auth,omitempty"`
	Handle  func() error // custom func validtion
}

IntegrationConfig used to inform each integration config

Jump to

Keyboard shortcuts

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