postgreshealth

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Example
ctx := context.Background()
logger := zap.NewNop()

// Your database
db := &sql.DB{}

dbMonitor := NewPostgresMonitorsWithMetrics("", db, logger)
monitor := &health.Monitor{}
monitor.AddProber(ctx, dbMonitor)
go monitor.RunChecks(ctx, 1*time.Second)

// Attach endpoints
mux := http.NewServeMux()
monitor.AttachHttp(mux)
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PingCheck

type PingCheck struct {
	On       time.Time     `json:"on"`
	Duration time.Duration `json:"duration"`
	Status   string        `json:"status"`
	Error    string        `json:"error"`
}

type PostgresMonitor

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

func NewPostgresMonitor

func NewPostgresMonitor(name string, db *sql.DB, l *zap.Logger) *PostgresMonitor

func NewPostgresMonitorWithMetrics

func NewPostgresMonitorWithMetrics(db *sql.DB, l *zap.Logger) *PostgresMonitor

func NewPostgresMonitorsWithMetrics added in v0.4.1

func NewPostgresMonitorsWithMetrics(name string, db *sql.DB, l *zap.Logger) *PostgresMonitor

func (*PostgresMonitor) Liveness added in v0.4.1

func (m *PostgresMonitor) Liveness(ctx context.Context) (probetype, redinesstype, name string, contents interface{}, err error)

func (*PostgresMonitor) Probe

func (m *PostgresMonitor) Probe(ctx context.Context) (err error)

func (*PostgresMonitor) Readiness

func (m *PostgresMonitor) Readiness(ctx context.Context) (probetype, redinesstype, name string, contents interface{}, err error)

type SizeCheck

type SizeCheck struct {
	On     time.Time `json:"on"`
	Size   uint64    `json:"size"`
	Status string    `json:"status"`
	Error  string    `json:"error"`
}

Jump to

Keyboard shortcuts

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