metric

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHeapCapacity = 100
)

Variables

View Source
var (
	// unit is ms
	ClusterWriteLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "cluster_write_latency",
		Help:    "cluster write request latency",
		Buckets: prometheus.ExponentialBuckets(1, 2, 14),
	}, []string{"namespace"})
	// unit is ms
	DBWriteLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "db_write_latency",
		Help:    "db write request latency",
		Buckets: prometheus.ExponentialBuckets(1, 2, 14),
	}, []string{"namespace"})
	// unit is ms
	RaftWriteLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "raft_write_latency",
		Help:    "raft write request latency",
		Buckets: prometheus.ExponentialBuckets(1, 2, 14),
	}, []string{"namespace", "step"})

	WriteByteSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "write_byte_size",
		Help:    "write request byte size",
		Buckets: prometheus.ExponentialBuckets(128, 2, 12),
	}, []string{"namespace"})

	SlowWrite100msCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "slow_write_100ms_cnt",
		Help: "slow 100ms counter for slow write command",
	}, []string{"table", "cmd"})
	SlowWrite50msCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "slow_write_50ms_cnt",
		Help: "slow 50ms counter for slow write command",
	}, []string{"table", "cmd"})
	SlowWrite10msCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "slow_write_10ms_cnt",
		Help: "slow 10ms counter for slow write command",
	}, []string{"table", "cmd"})
	SlowLimiterRefusedCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "slow_limiter_refused_cnt",
		Help: "slow limiter refused counter for slow write command",
	}, []string{"table", "cmd"})
	SlowLimiterQueuedCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "slow_limiter_queued_cnt",
		Help: "queued total counter for slow wait queue",
	}, []string{"table", "cmd", "slow_level"})
	SlowLimiterQueuedCost = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "slow_limiter_queued_cost",
		Help:    "slow limiter queued cost distribution in slow wait queue",
		Buckets: prometheus.ExponentialBuckets(1, 2, 14),
	}, []string{"namespace", "table", "cmd"})

	QueueLen = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "queue_len",
		Help: "queue length for all kinds of queue like raft proposal/transport/apply",
	}, []string{"namespace", "queue_name"})

	ErrorCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "error_cnt",
		Help: "error counter for some useful kinds of internal error",
	}, []string{"namespace", "error_info"})

	EventCnt = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "event_cnt",
		Help: "the important event counter for internal event",
	}, []string{"namespace", "event_name"})

	TableKeyNum = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "table_key_num",
		Help: "the key number stats for each table",
	}, []string{"table", "group"})

	TableDiskUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "table_disk_usage",
		Help: "the disk usage stats for each table",
	}, []string{"table", "group"})

	ReadCmdCounter = promauto.NewCounter(prometheus.CounterOpts{
		Name: "read_cmd_total",
		Help: "redis read command total counter",
	})
	WriteCmdCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "write_cmd_total",
		Help: "redis write command total counter",
	}, []string{"namespace"})

	CollectionLenDist = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "collection_length_dist",
		Help:    "the length distribute for the large collections",
		Buckets: prometheus.ExponentialBuckets(128, 2, 12),
	}, []string{"table"})
)
View Source
var TopnHotKeys = NewTopNHot()

Functions

This section is empty.

Types

type CollSizeHeap added in v0.8.4

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

func NewCollSizeHeap added in v0.8.4

func NewCollSizeHeap(cap int) *CollSizeHeap

func (*CollSizeHeap) TopKeys added in v0.8.4

func (csh *CollSizeHeap) TopKeys() []TopNInfo

func (*CollSizeHeap) Update added in v0.8.4

func (csh *CollSizeHeap) Update(key []byte, collSize int)

type CompactFilterStats added in v0.9.2

type CompactFilterStats struct {
	ExpiredCleanCnt int64 `json:"expired_clean_cnt,omitempty"`
	VersionCleanCnt int64 `json:"version_clean_cnt,omitempty"`
	DelCleanCnt     int64 `json:"del_clean_cnt,omitempty"`
}

type HKeyInfo added in v0.8.4

type HKeyInfo struct {
	//Value      []byte
	Cnt int32
}

func (*HKeyInfo) Inc added in v0.8.4

func (hki *HKeyInfo) Inc()

type Item added in v0.8.4

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

An Item is something we manage in a priority queue.

type LogSyncStats

type LogSyncStats struct {
	Name      string `json:"name"`
	Term      uint64 `json:"term"`
	Index     uint64 `json:"index"`
	Timestamp int64  `json:"timestamp"`
	IsLeader  bool   `json:"is_leader"`
}

type NamespaceStats

type NamespaceStats struct {
	Name              string                 `json:"name"`
	TStats            []TableStats           `json:"table_stats"`
	DBWriteStats      *WriteStats            `json:"db_write_stats"`
	ClusterWriteStats *WriteStats            `json:"cluster_write_stats"`
	InternalStats     map[string]interface{} `json:"internal_stats"`
	DBCompactStats    CompactFilterStats     `json:"db_compact_stats,omitempty"`
	EngType           string                 `json:"eng_type"`
	IsLeader          bool                   `json:"is_leader"`
	TopNWriteKeys     []TopNInfo             `json:"top_n_write_keys,omitempty"`
	TopNLargeCollKeys []TopNInfo             `json:"top_n_large_coll_keys,omitempty"`
}

type PriorityQueue added in v0.8.4

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len added in v0.8.4

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less added in v0.8.4

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop added in v0.8.4

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push added in v0.8.4

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap added in v0.8.4

func (pq PriorityQueue) Swap(i, j int)

type ScanStats

type ScanStats struct {
	ScanCount uint64 `json:"scan_count"`
	// <1024us, 2ms, 4ms, 8ms, 16ms, 32ms, 64ms, 128ms, 256ms, 512ms, 1024ms, 2048ms, 4s, 8s
	ScanLatencyStats [16]int64 `json:"scan_latency_stats"`
}

func (*ScanStats) Copy

func (ss *ScanStats) Copy() *ScanStats

func (*ScanStats) IncScanCount

func (ss *ScanStats) IncScanCount()

func (*ScanStats) UpdateLatencyStats

func (ss *ScanStats) UpdateLatencyStats(latencyUs int64)

func (*ScanStats) UpdateScanStats

func (ss *ScanStats) UpdateScanStats(latencyUs int64)

type ServerStats

type ServerStats struct {
	// database stats
	NSStats []NamespaceStats `json:"ns_stats"`
	//scan统计
	ScanStats *ScanStats `json:"scan_stats"`
}

type TableStats

type TableStats struct {
	Name              string `json:"name"`
	KeyNum            int64  `json:"key_num"`
	DiskBytesUsage    int64  `json:"disk_bytes_usage"`
	ApproximateKeyNum int64  `json:"approximate_key_num"`
}

type TopNHot added in v0.8.4

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

func NewTopNHot added in v0.8.4

func NewTopNHot() *TopNHot

func (*TopNHot) Clear added in v0.8.4

func (tnh *TopNHot) Clear()

Clear will clear all history lru data. Period reset can make sure some new data can be refreshed to lru

func (*TopNHot) Enable added in v0.8.4

func (tnh *TopNHot) Enable(on bool)

func (*TopNHot) GetTopNWrites added in v0.8.4

func (tnh *TopNHot) GetTopNWrites() []TopNInfo

func (*TopNHot) HitWrite added in v0.8.4

func (tnh *TopNHot) HitWrite(k []byte)

type TopNInfo added in v0.8.4

type TopNInfo struct {
	Key string
	Cnt int32
}

type WriteStats

type WriteStats struct {
	// <100bytes, <1KB, 2KB, 4KB, 8KB, 16KB, 32KB, 64KB, 128KB, 256KB, 512KB, 1MB, 2MB, 4MB
	ValueSizeStats [16]int64 `json:"value_size_stats"`
	// <1024us, 2ms, 4ms, 8ms, 16ms, 32ms, 64ms, 128ms, 256ms, 512ms, 1024ms, 2048ms, 4s, 8s
	WriteLatencyStats [16]int64 `json:"write_latency_stats"`
}

func (*WriteStats) BatchUpdateLatencyStats

func (ws *WriteStats) BatchUpdateLatencyStats(latencyUs int64, cnt int64)

func (*WriteStats) Copy

func (ws *WriteStats) Copy() *WriteStats

func (*WriteStats) UpdateLatencyStats

func (ws *WriteStats) UpdateLatencyStats(latencyUs int64)

func (*WriteStats) UpdateSizeStats

func (ws *WriteStats) UpdateSizeStats(vSize int64)

func (*WriteStats) UpdateWriteStats

func (ws *WriteStats) UpdateWriteStats(vSize int64, latencyUs int64)

Jump to

Keyboard shortcuts

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