probes

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("probe timed out")

Functions

func PGWithCA

func PGWithCA(ca []byte) func(*pgxpool.Config) error

/ PGWithCA adds the provided CA to the rootCAs of the pgxpool.

Types

type Manager

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

Manager manages a collection of Probers the check connectivity to AppCat services.

func NewManager

func NewManager(l logr.Logger) Manager

func (Manager) Collector

func (m Manager) Collector() prometheus.Collector

Collector returns the histogram to store the probe results

func (Manager) StartProbe

func (m Manager) StartProbe(p Prober)

StartProbe will send a probe once every second using the provided prober. If a prober with the same ProbeInfo already runs, it will stop the running prober.

func (Manager) StopProbe

func (m Manager) StopProbe(pi ProbeInfo)

StopProbe will stop the prober with the provided ProbeInfo. Is a Noop if none is running.

type PostgreSQL

type PostgreSQL struct {
	Service   string
	Instance  string
	Namespace string
	// contains filtered or unexported fields
}

PostgreSQL is a prober to test the uptime of a PostgreSQL instance.

func NewFailingPostgreSQL

func NewFailingPostgreSQL(service, name, namespace string) (*PostgreSQL, error)

NewFailingPostgreSQL creates a prober that will fail. Can be used if the controller can't access valid credentials.

func NewPostgreSQL

func NewPostgreSQL(service, name, namespace, dsn string, ops ...func(*pgxpool.Config) error) (*PostgreSQL, error)

NewPostgreSQL connects to the provided dsn and returns a prober

func (PostgreSQL) Close

func (p PostgreSQL) Close() error

Close closes open connections to the PostgreSQL server.

func (PostgreSQL) GetInfo

func (p PostgreSQL) GetInfo() ProbeInfo

GetInfo returns the prober infos

func (PostgreSQL) Probe

func (p PostgreSQL) Probe(ctx context.Context) error

Probe sends a test query to the configured PostgreSQL server. Will return an error if the prober does not have a valid db connection.

type ProbeInfo

type ProbeInfo struct {
	Service   string
	Name      string
	Namespace string
}

ProberInfo uniquely idetifies a prober and in turn an AppCat service instance

type Prober

type Prober interface {
	GetInfo() ProbeInfo
	Probe(ctx context.Context) error
	Close() error
}

Prober checks the connectivity to an AppCat service

Jump to

Keyboard shortcuts

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