health

package
v0.9.28 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 5 Imported by: 10

README

Health

Health package is a a source of all the default metrics and health measurements we may like to get from the services. It's written in a way so it would be easily extensible. Any structure fulfilling interface Prober, would automatically attach all the necessary information into process.

HTTP Interface

  • /health - Endpoint that always return 200 for dumb health check
  • /readiness - Endpoint meant to return information from different probes and return meaningful information about is service ready for connecting it to the traffic.
  • /liveness - Endpoint meant to return information from different probes and return meaningful information about is service healthy at all.

Metrics

Service produces a set of metrics

Database
  • health_database_ping - Duration how long it takes to ping the database (float seconds)
    • Tags:
      • database_type - The name of database type (eg. postgres)
      • name - The name of database (eg. search-cosmos)
  • health_database_size - Current size of database
    • Tags:
      • database_type - The name of database type (eg. postgres)
      • name - The name of database (eg. search-cosmos)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Liveness added in v0.4.1

type Liveness struct {
}

type Monitor

type Monitor struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Monitor) AddProber

func (m *Monitor) AddProber(ctx context.Context, p Prober)

func (*Monitor) AttachHttp

func (m *Monitor) AttachHttp(mux *http.ServeMux)

func (*Monitor) RunChecks

func (m *Monitor) RunChecks(ctx context.Context, dur time.Duration)

type Prober

type Prober interface {
	// Probe to run all the necessary checks on
	Probe(ctx context.Context) error
	// Readiness should return information about the readiness of resource
	Readiness(ctx context.Context) (probetype, readinesstype string, name string, contents interface{}, err error)
	// Liveness should return information about the liveness of resource
	Liveness(ctx context.Context) (probetype, livenesstype string, name string, contents interface{}, err error)
}

type Readiness

type Readiness struct {
	DB map[string]map[string]interface{} `json:"db"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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