Documentation
¶
Index ¶
- Constants
- Variables
- func FilterList(filter, metrics []string) []string
- func FilterRegex(regex string, metrics []string) ([]string, error)
- func MetricToPath(metric string) string
- func MetricToRelative(metric string) string
- func MetricsToPaths(metrics []string) []string
- func PathToMetric(p string) string
- func PathsToMetrics(p []string) []string
- func RelativeToMetric(p string) string
- type MetricData
- type MetricsCacheType
Constants ¶
const ( EncIdentity = iota EncSnappy EncMax )
Supported Encodings
Variables ¶
var Prefix string
Functions ¶
func FilterList ¶
FilterList returns a slice of strings that contain only the string found in both arguments. Set intersection.
func FilterRegex ¶
FilterRegex returns a sub set of metrics that match the given regex pattern.
func MetricToPath ¶
MetricToPath takes a metric name and return an absolute path using the --prefix flag.
func MetricToRelative ¶
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 ¶
MetricsToPaths operates on a slice of metric names and returns a slice of absolute paths using the --prefix flag.
func PathToMetric ¶
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 ¶
PathsToMetrics operates on a slice of absolute paths prefixed with the --prefix flag and returns a slice of metric names.
func RelativeToMetric ¶
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.