redisstats

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package redisstats records Redis-compatible command latency without ever retaining keys, values, arguments, or connection strings.

Index

Constants

View Source
const (
	DefaultMaxCommands = 256
	MaxCommandBytes    = 64
	OverflowCommand    = "(other)"
)
View Source
const SectionName = "redis"

Variables

View Source
var (
	ErrForeignHandle  = errors.New("redisstats: foreign generation handle")
	ErrNotDrained     = errors.New("redisstats: generation was not drained")
	ErrHandleReleased = errors.New("redisstats: generation handle was released")
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Command    string        `json:"command"`
	Count      int64         `json:"count"`
	ErrorCount int64         `json:"error_count"`
	Total      time.Duration `json:"total_ns"`
	Avg        time.Duration `json:"avg_ns"`
	Max        time.Duration `json:"max_ns"`
	P95        time.Duration `json:"p95_ns"`
}

Entry is one sanitized command aggregate.

type Frozen

type Frozen struct {
	Entries []Entry `json:"entries"`
	Dropped uint64  `json:"dropped"`
}

type GenerationCollector

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

func NewGenerationCollector

func NewGenerationCollector(registry *Registry) *GenerationCollector

func (*GenerationCollector) BeginBoundary

func (c *GenerationCollector) BeginBoundary(ctx context.Context, runID string, epoch runctl.Epoch) (runctl.BoundaryResult, error)

func (*GenerationCollector) Collect

func (c *GenerationCollector) Collect(handle runctl.GenerationHandle) (any, error)

func (*GenerationCollector) Drain

func (*GenerationCollector) Freeze

func (*GenerationCollector) Name

func (c *GenerationCollector) Name() string

func (*GenerationCollector) Release

func (c *GenerationCollector) Release(handle runctl.GenerationHandle)

type Registry

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

Registry is safe for concurrent clients and atomic generation rotation.

func NewRegistry

func NewRegistry(maxCommands int) *Registry

func (*Registry) Dropped

func (r *Registry) Dropped() uint64

func (*Registry) Observe

func (r *Registry) Observe(command string, duration time.Duration, err error)

Observe records only the upper-case command token. Supplying a full command such as "GET private-key" is safe: everything after the first whitespace is discarded before the registry is touched.

func (*Registry) Reset

func (r *Registry) Reset()

func (*Registry) Snapshot

func (r *Registry) Snapshot() []Entry

Jump to

Keyboard shortcuts

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