probes

package
v4.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: BSD-3-Clause Imports: 11 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
	Organization string
	ServiceLevel 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, organization, sla 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
	Organization string
	ServiceLevel string
}

ProbeInfo contains meta information on a prober and in turn an AppCat service

type Prober

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

Prober checks the connectivity to an AppCat service

type VSHNRedis added in v4.21.0

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

func NewRedis added in v4.21.0

func NewRedis(service, name, namespace, organization string, opts redis.Options) (*VSHNRedis, error)

func (VSHNRedis) Close added in v4.21.0

func (redis VSHNRedis) Close() error

func (VSHNRedis) GetInfo added in v4.21.0

func (redis VSHNRedis) GetInfo() ProbeInfo

func (VSHNRedis) Probe added in v4.21.0

func (redis VSHNRedis) Probe(ctx context.Context) error

Jump to

Keyboard shortcuts

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