db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLChecker

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

func NewMySQLChecker

func NewMySQLChecker(cfg MySQLConfig) (*MySQLChecker, error)

func (*MySQLChecker) Check

func (m *MySQLChecker) Check() (bool, string)

func (*MySQLChecker) GetCtx

func (m *MySQLChecker) GetCtx() context.Context

func (*MySQLChecker) GetDB

func (m *MySQLChecker) GetDB() *sql.DB

func (*MySQLChecker) GetHeartbeat

func (m *MySQLChecker) GetHeartbeat() time.Duration

func (*MySQLChecker) Name

func (m *MySQLChecker) Name() string

func (*MySQLChecker) StartMonitoring

func (m *MySQLChecker) StartMonitoring()

StartMonitoring will start logging at regular intervals (heartbeat)

func (*MySQLChecker) Stop

func (m *MySQLChecker) Stop()

Stop will cancel the monitoring process

type MySQLConfig

type MySQLConfig struct {
	Name             string
	DSN              string
	Username         string
	Password         string
	Logging          bool
	Heartbeat        time.Duration
	Ctx              context.Context
	MonitorResources bool // Flag for resource monitoring
}

type MySQLStats added in v0.0.2

type MySQLStats struct {
	Connections       int
	ActiveConnections int
	Questions         int64
	SlowQueries       int64
	Uptime            int64
	ThreadsRunning    int
	ThreadsConnected  int
}

type RedisChecker

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

func NewRedisChecker

func NewRedisChecker(cfg RedisConfig) *RedisChecker

func (*RedisChecker) Check

func (r *RedisChecker) Check() (bool, string)

func (*RedisChecker) GetClient

func (r *RedisChecker) GetClient() *redis.Client

func (*RedisChecker) GetCtx

func (r *RedisChecker) GetCtx() context.Context

func (*RedisChecker) GetHeartbeat

func (r *RedisChecker) GetHeartbeat() time.Duration

func (*RedisChecker) Name

func (r *RedisChecker) Name() string

func (*RedisChecker) StartMonitoring

func (r *RedisChecker) StartMonitoring()

StartMonitoring will start logging at regular intervals (heartbeat)

func (*RedisChecker) Stop

func (r *RedisChecker) Stop()

Stop will cancel the monitoring process

type RedisConfig

type RedisConfig struct {
	Name             string
	Addr             string
	Username         string // Redis username (for ACL support, Redis 6+)
	Password         string // Redis password
	DB               int
	Logging          bool
	Heartbeat        time.Duration
	Ctx              context.Context
	MonitorResources bool // Flag for resource monitoring
}

type RedisStats added in v0.0.2

type RedisStats struct {
	ConnectedClients      int64
	UsedMemory            int64
	UsedMemoryHuman       string
	TotalKeys             int64
	TotalConnections      int64
	OpsPerSecond          int64
	KeyspaceHits          int64
	KeyspaceMisses        int64
	KeyspaceHitRatio      float64
	UptimeInSeconds       int64
	RejectedConnections   int64
	ReplBacklogSize       int64
	UsedCpuSys            float64
	UsedCpuUser           float64
	MaxMemory             int64
	MaxMemoryHuman        string
	MemFragmentationRatio float64
}

Jump to

Keyboard shortcuts

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