healthcheck

package
v3.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package healthcheck provides primitives for running deep healtcheck service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunHealthCheck

func RunHealthCheck(port int, plusClient *client.NginxClient, cnf *configs.Configurator, healthProbeTLSSecret *v1.Secret)

RunHealthCheck starts the deep healthcheck service.

Types

type HealthServer

type HealthServer struct {
	Server                 *http.Server
	URL                    string
	UpstreamsForHost       func(host string) []string
	NginxUpstreams         func() (*client.Upstreams, error)
	StreamUpstreamsForName func(host string) []string
	NginxStreamUpstreams   func() (*client.StreamUpstreams, error)
}

HealthServer holds data required for running the healthcheck server.

func NewHealthServer

func NewHealthServer(addr string, nc *client.NginxClient, cnf *configs.Configurator, secret *v1.Secret) (*HealthServer, error)

NewHealthServer creates Health Server. If secret is provided, the server is configured with TLS Config.

func (*HealthServer) ListenAndServe

func (hs *HealthServer) ListenAndServe() error

ListenAndServe starts healthcheck server.

func (*HealthServer) Shutdown

func (hs *HealthServer) Shutdown(ctx context.Context) error

Shutdown shuts down healthcheck server.

func (*HealthServer) StreamStats

func (hs *HealthServer) StreamStats(w http.ResponseWriter, r *http.Request)

StreamStats calculates health stats for the TransportServer(s) identified by the service (action) name in the request URL.

func (*HealthServer) UpstreamStats

func (hs *HealthServer) UpstreamStats(w http.ResponseWriter, r *http.Request)

UpstreamStats calculates health stats for the host identified by the hostname in the request URL.

type HostStats

type HostStats struct {
	Total     int
	Up        int
	Unhealthy int
}

HostStats holds information about total, up and unhealthy number of 'peers' associated with the given host.

Jump to

Keyboard shortcuts

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