redis

package
v0.0.0-...-be347a3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package redis contains shared Redis functionality for the metric sets

Index

Constants

View Source
const (
	TypeNone      = "none"
	TypeString    = "string"
	TypeList      = "list"
	TypeSet       = "set"
	TypeSortedSet = "zset"
	TypeHash      = "hash"
)

Redis types

Variables

This section is empty.

Functions

func AssetRedis

func AssetRedis() string

AssetRedis returns asset data. This is the base64 encoded gzipped contents of ../metricbeat/module/redis.

func FetchKeyInfo

func FetchKeyInfo(c rd.Conn, key string) (map[string]interface{}, error)

FetchKeyInfo collects info about a key

func FetchKeys

func FetchKeys(c rd.Conn, pattern string, limit uint) ([]string, error)

FetchKeys gets a list of keys based on a pattern using SCAN, `limit` is a safeguard to limit the number of commands executed and the number of keys returned, if more than `limit` keys are being collected the method stops and returns the keys already collected. Setting `limit` to ' disables this limit.

func FetchRedisInfo

func FetchRedisInfo(stat string, c rd.Conn) (map[string]string, error)

FetchRedisInfo returns a map of requested stats.

func FetchSlowLogLength

func FetchSlowLogLength(c rd.Conn) (int64, error)

FetchSlowLogLength returns count of slow operations

func ParseRedisInfo

func ParseRedisInfo(info string) map[string]string

ParseRedisInfo parses the string returned by the INFO command Every line is split up into key and value

func ParseRedisLine

func ParseRedisLine(s string, delimiter string) []string

ParseRedisLine parses a single line returned by INFO

func Select

func Select(c rd.Conn, keyspace uint) error

Select selects the keyspace to use for this connection

Types

type MetricSet

type MetricSet struct {
	mb.BaseMetricSet
	// contains filtered or unexported fields
}

MetricSet for fetching Redis server information and statistics.

func NewMetricSet

func NewMetricSet(base mb.BaseMetricSet) (*MetricSet, error)

NewMetricSet creates the base for Redis metricsets

func (*MetricSet) Close

func (m *MetricSet) Close() error

Close redis connections

func (*MetricSet) Connection

func (m *MetricSet) Connection() rd.Conn

Connection returns a redis connection from the pool

func (*MetricSet) OriginalDBNumber

func (m *MetricSet) OriginalDBNumber() uint

OriginalDBNumber returns the originally configured database number, this can be used by metricsets that change keyspace to go back to the originally configured one

type Pool

type Pool struct {
	*rd.Pool
	// contains filtered or unexported fields
}

Pool is a redis pool that keeps track of the database number originally configured

func CreatePool

func CreatePool(
	host, password, network string,
	dbNumber int,
	maxConn int,
	idleTimeout, connTimeout time.Duration,
) *Pool

CreatePool creates a redis connection pool

func (*Pool) DBNumber

func (p *Pool) DBNumber() int

DBNumber returns the db number originally used to configure this pool

Directories

Path Synopsis
Package info fetches Redis server information and statistics using the Redis INFO command.
Package info fetches Redis server information and statistics using the Redis INFO command.

Jump to

Keyboard shortcuts

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