Documentation ¶
Index ¶
- Variables
- func GetMetricDbKey(metric string) string
- func GetMetricRetentionDbKey(metric string) string
- func InitGraphiteMetrics()
- func NewRedisPool(redisURI string, dbID ...int) *redis.Pool
- func ParseMetricFromString(line []byte) ([]byte, float64, int64, error)
- func UpdateProcessingMetrics()
- type CacheStorage
- func (cs *CacheStorage) EnrichMatchedMetric(buffer map[string]*MatchedMetric, m *MatchedMetric)
- func (cs *CacheStorage) GetRetention(m *MatchedMetric) int
- func (cs *CacheStorage) ProcessMatchedMetrics(ch chan *MatchedMetric, save func(map[string]*MatchedMetric))
- func (cs *CacheStorage) SavePoints(buffer map[string]*MatchedMetric, db *DbConnector) error
- type DbConnector
- type MatchedMetric
- type PatternNode
- type PatternStorage
Constants ¶
This section is empty.
Variables ¶
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 )
var LogParseErrors bool
LogParseErrors flag to log parse errors
Functions ¶
func GetMetricDbKey ¶
GetMetricDbKey returns string redis key for metric
func GetMetricRetentionDbKey ¶
GetMetricRetentionDbKey returns string redis key for metric retention
func InitGraphiteMetrics ¶
func InitGraphiteMetrics()
InitGraphiteMetrics initialize graphite metrics
func NewRedisPool ¶ added in v1.1.3
NewRedisPool return redis.Pool from host:port URI
func ParseMetricFromString ¶ added in v1.1.4
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 ¶
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