filter

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TotalMetricsReceived metrics counter
	TotalMetricsReceived metrics.Meter
	// ValidMetricsReceived metrics counter
	ValidMetricsReceived metrics.Meter
	// MatchingMetricsReceived metrics counter
	MatchingMetricsReceived metrics.Meter
	// MatchingTimer metrics timer
	MatchingTimer metrics.Timer
	// SavingTimer metrics timer
	SavingTimer metrics.Timer
	// BuildTreeTimer metrics timer
	BuildTreeTimer metrics.Timer
)
View Source
var LogParseErrors bool

LogParseErrors flag to log parse errors

Functions

func GetMetricDbKey

func GetMetricDbKey(metric string) string

GetMetricDbKey returns string redis key for metric

func GetMetricRetentionDbKey

func GetMetricRetentionDbKey(metric string) string

GetMetricRetentionDbKey returns string redis key for metric retention

func InitGraphiteMetrics

func InitGraphiteMetrics()

InitGraphiteMetrics initialize graphite metrics

func NewRedisPool added in v1.1.3

func NewRedisPool(redisURI string, dbID ...int) *redis.Pool

NewRedisPool return redis.Pool from host:port URI

func ParseMetricFromString added in v1.1.4

func ParseMetricFromString(line []byte) ([]byte, float64, int64, error)

ParseMetricFromString parses metric from string supported format: "<metricString> <valueFloat64> <timestampInt64>"

func UpdateProcessingMetrics

func UpdateProcessingMetrics()

UpdateProcessingMetrics update processing metrics on demand

Types

type CacheStorage

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

CacheStorage struct to store retention matchers

func NewCacheStorage

func NewCacheStorage(retentionScanner *bufio.Scanner) (*CacheStorage, error)

NewCacheStorage create new CacheStorage

func (*CacheStorage) EnrichMatchedMetric added in v1.1.3

func (cs *CacheStorage) EnrichMatchedMetric(buffer map[string]*MatchedMetric, m *MatchedMetric)

EnrichMatchedMetric calculate retention and filter cached values

func (*CacheStorage) GetRetention added in v1.1.3

func (cs *CacheStorage) GetRetention(m *MatchedMetric) int

GetRetention returns first matched retention for metric

func (*CacheStorage) ProcessMatchedMetrics added in v1.1.3

func (cs *CacheStorage) ProcessMatchedMetrics(ch chan *MatchedMetric, save func(map[string]*MatchedMetric))

ProcessMatchedMetrics make buffer of metrics and save it

func (*CacheStorage) SavePoints

func (cs *CacheStorage) SavePoints(buffer map[string]*MatchedMetric, db *DbConnector) error

SavePoints saving matched metrics to DB

type DbConnector

type DbConnector struct {
	Pool *redis.Pool
}

DbConnector is DB layer client

func NewDbConnector

func NewDbConnector(pool *redis.Pool) *DbConnector

NewDbConnector return db connector

func (*DbConnector) UpdateMetricsHeartbeat added in v1.1.3

func (connector *DbConnector) UpdateMetricsHeartbeat() error

UpdateMetricsHeartbeat increments redis counter

type MatchedMetric

type MatchedMetric struct {
	Metric             string
	Patterns           []string
	Value              float64
	Timestamp          int64
	RetentionTimestamp int64
	Retention          int
}

MatchedMetric represent parsed and matched metric data

type PatternNode

type PatternNode struct {
	Children   []*PatternNode
	Part       string
	Hash       uint32
	Prefix     string
	InnerParts []string
}

PatternNode contains pattern node

type PatternStorage

type PatternStorage struct {
	PatternTree *PatternNode
}

PatternStorage contains pattern tree

func NewPatternStorage

func NewPatternStorage() *PatternStorage

NewPatternStorage creates new PatternStorage struct

func (*PatternStorage) DoRefresh

func (t *PatternStorage) DoRefresh(db *DbConnector) error

DoRefresh builds pattern tree from redis data

func (*PatternStorage) MatchPattern

func (t *PatternStorage) MatchPattern(metric []byte) []string

MatchPattern returns array of matched patterns

func (*PatternStorage) ProcessIncomingMetric

func (t *PatternStorage) ProcessIncomingMetric(lineBytes []byte) *MatchedMetric

ProcessIncomingMetric validates, parses and matches incoming raw string

func (*PatternStorage) Refresh

func (t *PatternStorage) Refresh(db *DbConnector, terminate chan bool, wg *sync.WaitGroup)

Refresh run infinite refresh of patterns tree

Jump to

Keyboard shortcuts

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