redis

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectivityCheck

type ConnectivityCheck struct {
	Severity string `toml:"severity"`
}

type CountCheck

type CountCheck struct {
	WarnGe     int `toml:"warn_ge"`
	CriticalGe int `toml:"critical_ge"`
}

type Instance

type Instance struct {
	config.InternalConfig
	Partial string `toml:"partial"`

	Targets          []string          `toml:"targets"`
	Concurrency      int               `toml:"concurrency"`
	Timeout          config.Duration   `toml:"timeout"`
	ReadTimeout      config.Duration   `toml:"read_timeout"`
	Username         string            `toml:"username"`
	Password         string            `toml:"password"`
	DB               int               `toml:"db"`
	Connectivity     ConnectivityCheck `toml:"connectivity"`
	ResponseTime     ResponseTimeCheck `toml:"response_time"`
	Role             RoleCheck         `toml:"role"`
	ConnectedClients CountCheck        `toml:"connected_clients"`
	BlockedClients   CountCheck        `toml:"blocked_clients"`
	UsedMemory       MemoryUsageCheck  `toml:"used_memory"`
	RejectedConn     CountCheck        `toml:"rejected_connections"`
	MasterLink       MasterLinkCheck   `toml:"master_link_status"`
	ConnectedSlaves  MinCountCheck     `toml:"connected_slaves"`
	EvictedKeys      CountCheck        `toml:"evicted_keys"`
	ExpiredKeys      CountCheck        `toml:"expired_keys"`
	OpsPerSecond     OpsPerSecondCheck `toml:"instantaneous_ops_per_sec"`
	Persistence      PersistenceCheck  `toml:"persistence"`

	tlscfg.ClientConfig
	// contains filtered or unexported fields
}

func (*Instance) Gather

func (ins *Instance) Gather(q *safe.Queue[*types.Event])

func (*Instance) Init

func (ins *Instance) Init() error

type MasterLinkCheck

type MasterLinkCheck struct {
	Expect   string `toml:"expect"`
	Severity string `toml:"severity"`
}

type MemoryUsageCheck

type MemoryUsageCheck struct {
	WarnGe     config.Size `toml:"warn_ge"`
	CriticalGe config.Size `toml:"critical_ge"`
}

type MinCountCheck

type MinCountCheck struct {
	WarnLt     int `toml:"warn_lt"`
	CriticalLt int `toml:"critical_lt"`
}

type OpsPerSecondCheck

type OpsPerSecondCheck struct {
	WarnGe     int `toml:"warn_ge"`
	CriticalGe int `toml:"critical_ge"`
}

type Partial

type Partial struct {
	ID          string          `toml:"id"`
	Concurrency int             `toml:"concurrency"`
	Timeout     config.Duration `toml:"timeout"`
	ReadTimeout config.Duration `toml:"read_timeout"`
	Username    string          `toml:"username"`
	Password    string          `toml:"password"`
	DB          int             `toml:"db"`
	tlscfg.ClientConfig
	Connectivity     ConnectivityCheck `toml:"connectivity"`
	ResponseTime     ResponseTimeCheck `toml:"response_time"`
	Role             RoleCheck         `toml:"role"`
	ConnectedClients CountCheck        `toml:"connected_clients"`
	BlockedClients   CountCheck        `toml:"blocked_clients"`
	UsedMemory       MemoryUsageCheck  `toml:"used_memory"`
	RejectedConn     CountCheck        `toml:"rejected_connections"`
	MasterLink       MasterLinkCheck   `toml:"master_link_status"`
	ConnectedSlaves  MinCountCheck     `toml:"connected_slaves"`
	EvictedKeys      CountCheck        `toml:"evicted_keys"`
	ExpiredKeys      CountCheck        `toml:"expired_keys"`
	OpsPerSecond     OpsPerSecondCheck `toml:"instantaneous_ops_per_sec"`
	Persistence      PersistenceCheck  `toml:"persistence"`
}

type PersistenceCheck

type PersistenceCheck struct {
	Enabled  bool   `toml:"enabled"`
	Severity string `toml:"severity"`
}

type RedisAccessor

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

RedisAccessor encapsulates a Redis connection and provides structured data access. It handles connection, authentication, protocol interaction, and response parsing. Thread-unsafe: callers must synchronize concurrent use.

func NewRedisAccessor

func NewRedisAccessor(cfg RedisAccessorConfig) (*RedisAccessor, error)

NewRedisAccessor creates a connected and authenticated RedisAccessor.

func (*RedisAccessor) ClientList

func (a *RedisAccessor) ClientList() (string, error)

ClientList executes CLIENT LIST and returns the raw response.

func (*RedisAccessor) Close

func (a *RedisAccessor) Close() error

Close releases the underlying TCP connection.

func (*RedisAccessor) Command

func (a *RedisAccessor) Command(args ...string) (string, error)

Command executes an arbitrary Redis command and returns the string reply. For use by diagnostic tools that need flexible access.

func (*RedisAccessor) ConfigGet

func (a *RedisAccessor) ConfigGet(pattern string) (string, error)

ConfigGet executes CONFIG GET <pattern> and returns the raw key-value pairs. Sensitive fields (passwords, auth keys) are redacted.

func (*RedisAccessor) DBSize

func (a *RedisAccessor) DBSize() (string, error)

DBSize executes DBSIZE and returns the reply.

func (*RedisAccessor) Info

func (a *RedisAccessor) Info(section string) (map[string]string, error)

Info executes INFO <section> and returns the parsed key-value map.

func (*RedisAccessor) InfoRaw

func (a *RedisAccessor) InfoRaw(section string) (string, error)

InfoRaw executes INFO <section> and returns the raw string output.

func (*RedisAccessor) Ping

func (a *RedisAccessor) Ping() error

Ping sends PING and returns nil if the reply is PONG.

func (*RedisAccessor) SlowlogGet

func (a *RedisAccessor) SlowlogGet(count int) (string, error)

SlowlogGet executes SLOWLOG GET <count> and returns the raw response.

func (*RedisAccessor) Target

func (a *RedisAccessor) Target() string

Target returns the target address this accessor is connected to.

type RedisAccessorConfig

type RedisAccessorConfig struct {
	Target      string
	Username    string
	Password    string
	DB          int
	Timeout     time.Duration
	ReadTimeout time.Duration
	TLSConfig   *tls.Config
	DialFunc    func(network, address string) (net.Conn, error)
}

RedisAccessorConfig holds the connection parameters for creating a RedisAccessor.

type RedisPlugin

type RedisPlugin struct {
	config.InternalConfig
	Partials  []Partial   `toml:"partials"`
	Instances []*Instance `toml:"instances"`
}

func (*RedisPlugin) ApplyPartials

func (p *RedisPlugin) ApplyPartials() error

func (*RedisPlugin) GetInstances

func (p *RedisPlugin) GetInstances() []plugins.Instance

func (*RedisPlugin) RegisterDiagnoseTools

func (p *RedisPlugin) RegisterDiagnoseTools(registry *diagnose.ToolRegistry)

RegisterDiagnoseTools implements plugins.Diagnosable for RedisPlugin. It registers read-only diagnostic tools and the accessor factory.

type ResponseTimeCheck

type ResponseTimeCheck struct {
	WarnGe     config.Duration `toml:"warn_ge"`
	CriticalGe config.Duration `toml:"critical_ge"`
}

type RoleCheck

type RoleCheck struct {
	Expect   string `toml:"expect"`
	Severity string `toml:"severity"`
}

Jump to

Keyboard shortcuts

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