rrd

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Printer

type Printer interface {
	Print(w io.Writer) error
}

type RRD

type RRD interface {
	// Slot returns the current window (slot) to store values.
	Slot() (Slot, error)
	// Counters, return all stored counters since the given time (since) until now.
	Counters(since time.Time) (map[string]float64, error)
	// Last returns the last reported value for a metric given the metric
	// name
	Last(key string) (value float64, ok bool, err error)

	// Close the db
	Close() error
}

RRD is a round robin database of fixed size which is specified on creation RRD stores `counter` values. Which means values that can only go UP. then it's easy to compute the increase of this counter over a given window The database only keep history based on retention.

func NewRRDBolt

func NewRRDBolt(path string, window time.Duration, retention time.Duration) (RRD, error)

NewRRDBolt creates a new rrd database that uses bolt as a storage. if window or retention are 0 the function will panic. If retnetion is smaller then window the function will panic. retention and window must be multiple of 1 minute.

type Slot

type Slot interface {
	// Counter sets (or overrides) the current stored value for this key,
	// with value
	Counter(key string, value float64) error
	// Key return the key of the slot which is the window timestamp
	Key() uint64
}

Jump to

Keyboard shortcuts

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