analyzer

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

data structures

scanner to iterate all keys in the redis

Index

Constants

View Source
const (

	// expire section
	Second = 1000000000
	Minute = Second * 60
	Hour   = Minute * 60
	Day    = Hour * 24
	Week   = Day * 7

	// data size
	B  = 1
	KB = B * 1024
	MB = KB * 1024
)

Variables

This section is empty.

Functions

func MergeKeyMeta

func MergeKeyMeta(cli redis.UniversalClient, supportMemUsage bool, ks []string, stat *RedisStat)

Types

type Distribution

type Distribution struct {
	KeyPattern string `json:"pattern"`
	Metrics
}

distributions of keys of all prefixes

type KeyMeta

type KeyMeta struct {
	Key      string
	KeySize  int64
	DataSize int64
	Ttl      int64
	Type     string
}

type KeyStat

type KeyStat struct {
	Distribution map[string]Distribution `json:"distribution"`
	Metrics
}

total stat and distributions

func (*KeyStat) Merge

func (stat *KeyStat) Merge(meta KeyMeta)

type Metrics

type Metrics struct {
	KeyCount       int64 `json:"keyCount"`
	KeySize        int64 `json:"keySize"`
	DataSize       int64 `json:"dataSize"`
	KeyNeverExpire int64 `json:"neverExpire"`
	ExpireInHour   int64 `json:"expireInHour"`  // >= 0h < 1h
	ExpireInDay    int64 `json:"expireInDay"`   // >= 1h < 24h
	ExpireInWeek   int64 `json:"expireInWeek"`  // >= 1d < 7d
	ExpireOutWeek  int64 `json:"expireOutWeek"` // >= 7d
}

basic metrics of a group of key

func (*Metrics) MergeMeta

func (m *Metrics) MergeMeta(meta KeyMeta)

type RedisStat

type RedisStat struct {
	All     KeyStat `json:"all"`
	String  KeyStat `json:"string"`
	Hash    KeyStat `json:"hash"`
	Set     KeyStat `json:"set"`
	List    KeyStat `json:"list"`
	ZSet    KeyStat `json:"zset"`
	Other   KeyStat `json:"other"`
	BigKeys KeyStat `json:"bigKeys"`
}

func ScanAllKeys

func ScanAllKeys(cli redis.UniversalClient) RedisStat

func (*RedisStat) Compact

func (stat *RedisStat) Compact()

func (*RedisStat) Merge

func (stat *RedisStat) Merge(meta KeyMeta)

func (*RedisStat) Print

func (stat *RedisStat) Print()

Jump to

Keyboard shortcuts

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