metrics

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncIdentity = iota
	EncSnappy
	EncMax
)

Supported Encodings

Variables

View Source
var Prefix string

Functions

func FilterList

func FilterList(filter, metrics []string) []string

FilterList returns a slice of strings that contain only the string found in both arguments. Set intersection.

func FilterRegex

func FilterRegex(regex string, metrics []string) ([]string, error)

FilterRegex returns a sub set of metrics that match the given regex pattern.

func MetricToPath

func MetricToPath(metric string) string

MetricToPath takes a metric name and return an absolute path using the --prefix flag.

func MetricToRelative

func MetricToRelative(metric string) string

MetricToRelative take a metric name and returns a relative path to the Whisper DB. This path combined with the root path to the DB store would create a proper absolute path.

func MetricsToPaths

func MetricsToPaths(metrics []string) []string

MetricsToPaths operates on a slice of metric names and returns a slice of absolute paths using the --prefix flag.

func PathToMetric

func PathToMetric(p string) string

PathToMetric takes an absolute path that begins with the --prefix flag and returns the metric name. The path is path.Clean()'d before transformed.

func PathsToMetrics

func PathsToMetrics(p []string) []string

PathsToMetrics operates on a slice of absolute paths prefixed with the --prefix flag and returns a slice of metric names.

func RelativeToMetric

func RelativeToMetric(p string) string

RelativeToMetric takes a relative path from the root of your DB store and translates it into a metric name. Path is path.Clean()'d before transformed.

Types

type MetricData

type MetricData struct {
	Name     string
	Size     int64
	Mode     int64
	ModTime  int64
	Encoding int
	Data     []byte `json:"-"` // We never JSON encode metric data
}

MetricData represents an individual metric and its raw data.

type MetricsCacheType

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

func NewMetricsCache

func NewMetricsCache() *MetricsCacheType

NewMetricsCache creates and returns a MetricsCacheType object

func (*MetricsCacheType) GetMetrics

func (m *MetricsCacheType) GetMetrics() ([]string, bool)

GetMetrics returns a slice of metric key names and an ok boolean. This function returns immediately even if the metric cache is out of date and is being refreshed. In this case ok will be false until the cache is rebuilt.

func (*MetricsCacheType) IsAvailable

func (m *MetricsCacheType) IsAvailable() bool

IsAvailable returns a boolean true value if the MetricsCache is avaliable for use. Rebuilding the cache can take some time.

func (*MetricsCacheType) RefreshCache

func (m *MetricsCacheType) RefreshCache() error

RefreshCache updates the list of metric names in the cache from the local file store. Blocks until completion. Does not check cache freshness so use with care.

func (*MetricsCacheType) TimedOut

func (m *MetricsCacheType) TimedOut() bool

TimedOut returns true if the cache hasn't been refresed recently.

Jump to

Keyboard shortcuts

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