health

package
v0.4.101 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 19 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 struct {
	// contains filtered or unexported fields
}

Checker checks the health of a local experiment instance.

func NewChecker

func NewChecker(pp *PortProbe, ec *EndpointClient) *Checker

NewChecker creates a new Checker.

func NewCheckerK8S

func NewCheckerK8S(pp *PortProbe, k8s *KubernetesClient, ec *EndpointClient) *Checker

NewCheckerK8S creates a new Checker for Kubernetes deployments.

func (*Checker) GetHealth

func (hc *Checker) GetHealth(ctx context.Context) float64

GetHealth combines a set of health checks into a single score.

type EndpointClient

type EndpointClient struct {
	http.Client
}

EndpointClient is an http client to check the local /health endpoint.

func NewEndpointClient

func NewEndpointClient(timeout time.Duration) *EndpointClient

NewEndpointClient returns a new *EndpointClient with the specified request timeout.

type GCEClient

type GCEClient interface {
	GetHealth(context.Context, *computepb.GetHealthRegionBackendServiceRequest, ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error)
}

GCEClient queries the Compute API for health updates.

type GCPChecker

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

GCPChecker queries the VM's load balancer to check its status.

func NewGCPChecker

func NewGCPChecker(c GCEClient, md Metadata) *GCPChecker

NewGCPChecker returns a new instance of GCPChecker.

func (*GCPChecker) GetHealth

func (c *GCPChecker) GetHealth(ctx context.Context) float64

GetHealth contacts the GCP load balancer to get the latest VM health status and uses the data to generate a health score.

type KubernetesClient

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

KubernetesClient manages requests to the Kubernetes API server.

func MustNewKubernetesClient

func MustNewKubernetesClient(url *url.URL, pod, node, namespace, auth string) *KubernetesClient

MustNewKubernetesClient creates a new KubenernetesClient instance. If the client cannot be instantiated, the function will exit.

type Metadata

type Metadata interface {
	Project() string
	Backend() string
	Region() string
	Group() string
}

Metadata returns environmental metadata for a machine.

type PortProbe

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

PortProbe checks whether a set of ports are open.

func NewPortProbe

func NewPortProbe(services map[string][]string) *PortProbe

NewPortProbe creates a new PortProbe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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