checks

package
v0.0.0-...-edbed3e Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckContextStatus

func CheckContextStatus(ctx context.Context, name ...string) error

func CheckHttpStatus

func CheckHttpStatus(ctx context.Context, url string, timeout time.Duration) error

func CheckMongoClientStatus

func CheckMongoClientStatus(ctx context.Context, client *mongo.Client) error

func CheckMongoDBStatus

func CheckMongoDBStatus(ctx context.Context, connectionString string, timeoutConnect time.Duration, timeoutDisconnect time.Duration, timeoutPing time.Duration) error

func CheckMqttClientStatus

func CheckMqttClientStatus(ctx context.Context, mqttClient mqtt.Client) error

func CheckMySQLStatus

func CheckMySQLStatus(ctx context.Context, db *sql.DB, connectionString string) error

func CheckPingStatus

func CheckPingStatus(URL, Method string, Timeout int, Body io.Reader, Headers map[string]string) error

func CheckRedisStatus

func CheckRedisStatus(ctx context.Context, connectionString string) error

func CheckSignalClientStatus

func CheckSignalClientStatus(ctx context.Context, client signalr.Client) error

func CheckSignalRSrvHttpStatus

func CheckSignalRSrvHttpStatus(ctx context.Context, address string, wcaddress string) error

func CheckSignalRSrvStatus

func CheckSignalRSrvStatus(ctx context.Context, address string, wcaddress string) error

func NewContextCheck

func NewContextCheck(ctx context.Context, name ...string) *contextCheck

Types

type HttpCheck

type HttpCheck struct {
	// Ctx is the context that will be used for the health check.
	Ctx context.Context
	// URL is the remote service health check URL.
	URL string
	// RequestTimeout is the duration that health check will try to consume published test message.
	// If not set - 5 seconds
	RequestTimeout time.Duration

	Error error
}

Config is the HTTP checker configuration settings container.

func NewHttpCheck

func NewHttpCheck(ctx context.Context, url string, timeout time.Duration) HttpCheck

func (HttpCheck) CheckStatus

func (check HttpCheck) CheckStatus() error

New creates new HTTP service health check that verifies the following: - connection establishing - getting response status from defined URL - verifying that status code is less than 500

type MongoClientCheck

type MongoClientCheck struct {
	Ctx           context.Context
	MongoDBClient *mongo.Client
}

func NewMongoClientCheck

func NewMongoClientCheck(ctx context.Context, client *mongo.Client) MongoClientCheck

func (MongoClientCheck) CheckStatus

func (check MongoClientCheck) CheckStatus() error

type MongoDbCheck

type MongoDbCheck struct {
	Ctx context.Context

	MongoDBClient *mongo.Client
	// DSN is the MongoDB instance connection DSN. Required.
	ConnectionString string

	// TimeoutConnect defines timeout for establishing mongo connection, if not set - default value is used
	TimeoutConnect time.Duration
	// TimeoutDisconnect defines timeout for closing connection, if not set - default value is used
	TimeoutDisconnect time.Duration
	// TimeoutDisconnect defines timeout for making ping request, if not set - default value is used
	TimeoutPing time.Duration
	// return the check error
	Error error
}

Config is the MongoDB checker configuration settings container.

func NewMongoDbCheck

func NewMongoDbCheck(ctx context.Context, connectionString string, timeoutConnect time.Duration, timeoutDisconnect time.Duration, timeoutPing time.Duration) MongoDbCheck

func (MongoDbCheck) CheckStatus

func (check MongoDbCheck) CheckStatus() error

type MqttClientCheck

type MqttClientCheck struct {
	Ctx        context.Context
	MqttClient mqtt.Client
	Error      error
}

func NewMqttClientCheck

func NewMqttClientCheck(ctx context.Context, mqttClient mqtt.Client) MqttClientCheck

func (MqttClientCheck) CheckStatus

func (check MqttClientCheck) CheckStatus() error

type MySQLCheck

type MySQLCheck struct {
	Ctx              context.Context
	ConnectionString string
	DB               *sql.DB
	Error            error
}

func NewMySQLCheck

func NewMySQLCheck(ctx context.Context, db *sql.DB, connectionString string) MySQLCheck

func (*MySQLCheck) CheckStatus

func (check *MySQLCheck) CheckStatus() error

func (*MySQLCheck) CheckbyConnectionString

func (check *MySQLCheck) CheckbyConnectionString() error

type PingCheck

type PingCheck struct {
	URL     string
	Method  string
	Timeout int

	Body    io.Reader
	Headers map[string]string
	Error   error
	// contains filtered or unexported fields
}

func NewPingCheck

func NewPingCheck(URL, Method string, Timeout int, Body io.Reader, Headers map[string]string) PingCheck

func (PingCheck) Name

func (p PingCheck) Name() string

type RedisCheck

type RedisCheck struct {
	Ctx              context.Context
	ConnectionString string
	Error            error
}

Config is the Redis checker configuration settings container.

func NewRedisCheck

func NewRedisCheck(ctx context.Context, connectionString string) RedisCheck

func (RedisCheck) CheckStatus

func (check RedisCheck) CheckStatus() error

type SignalClientCheck

type SignalClientCheck struct {
	Ctx          context.Context
	SignalClient signalr.Client
	Error        error
}

func NewSignalClientCheck

func NewSignalClientCheck(ctx context.Context, client signalr.Client) SignalClientCheck

func (SignalClientCheck) CheckStatus

func (check SignalClientCheck) CheckStatus() error

type SignalRSrvCheck

type SignalRSrvCheck struct {
	Ctx           context.Context
	WcAddress     string
	ServerAddress string
	Error         error
}

func NewSignalRSrvCheck

func NewSignalRSrvCheck(ctx context.Context, address string, wcaddress string) SignalRSrvCheck

func (SignalRSrvCheck) CheckStatus

func (check SignalRSrvCheck) CheckStatus() error

func (SignalRSrvCheck) CheckhttpStatus

func (check SignalRSrvCheck) CheckhttpStatus() error

Jump to

Keyboard shortcuts

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