health

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CheckName = "health"

Variables

This section is empty.

Functions

func NewCheck

func NewCheck() checks.Check

NewCheck creates a new instance of the health check

Types

type Config added in v0.3.1

type Config struct {
	Targets  []string           `json:"targets,omitempty" yaml:"targets,omitempty"`
	Interval time.Duration      `json:"interval" yaml:"interval"`
	Timeout  time.Duration      `json:"timeout" yaml:"timeout"`
	Retry    helper.RetryConfig `json:"retry" yaml:"retry"`
}

Config defines the configuration parameters for a health check

func (*Config) For added in v0.3.1

func (c *Config) For() string

For returns the name of the check

func (*Config) Validate added in v0.3.1

func (c *Config) Validate() error

Validate checks if the configuration is valid

type Health

type Health struct {
	checks.CheckBase
	// contains filtered or unexported fields
}

Health is a check that measures the availability of an endpoint

func (*Health) GetConfig added in v0.3.1

func (h *Health) GetConfig() checks.Runtime

GetConfig returns the current configuration of the check

func (*Health) GetMetricCollectors

func (h *Health) GetMetricCollectors() []prometheus.Collector

GetMetricCollectors returns all metric collectors of check

func (*Health) Name added in v0.3.1

func (h *Health) Name() string

Name returns the name of the check

func (*Health) Run

func (h *Health) Run(ctx context.Context, cResult chan checks.ResultDTO) error

Run starts the health check

func (*Health) Schema

func (h *Health) Schema() (*openapi3.SchemaRef, error)

Schema provides the schema of the data that will be provided by the health check

func (*Health) SetConfig

func (h *Health) SetConfig(cfg checks.Runtime) error

SetConfig sets the configuration for the health check

func (*Health) Shutdown

func (h *Health) Shutdown(_ context.Context) error

Shutdown is called once when the check is unregistered or sparrow shuts down

Jump to

Keyboard shortcuts

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