Documentation ¶
Overview ¶
Package processor contains all routines performing processing on incoming metrics.
Index ¶
- Variables
- func ParseTime(str string) (time.Time, error)
- type DefaultInstance
- type Instance
- type MetricMap
- func (m MetricMap) FlattenValues() MetricMap
- func (m MetricMap) Get(key string) (interface{}, bool)
- func (m MetricMap) GetStr(key, defValue string) (string, error)
- func (m MetricMap) GetTimeFromStr(key string, defValue time.Time) (time.Time, error)
- func (m MetricMap) GetUint64(key string, defValue uint64) (uint64, error)
Constants ¶
This section is empty.
Variables ¶
var NewProcessor = func(config *exchange.SystemConfig, memory *exchange.MetricMemory) (Instance, error) { processor := DefaultInstance{ config: config, memory: memory, stats: &processorStats{mutex: &sync.RWMutex{}}, } return &processor, nil }
NewProcessor returns instance of ProcessorInstance referencing SystemConfig and MetricMemory instances given by caller.
Functions ¶
Types ¶
type DefaultInstance ¶
type DefaultInstance struct {
// contains filtered or unexported fields
}
DefaultInstance wires together all data elements required to perform metrics processing.
func (*DefaultInstance) Config ¶
func (p *DefaultInstance) Config() *exchange.SystemConfig
Config gets the config referenced by this processor instance
func (*DefaultInstance) DeliverStatus ¶
func (p *DefaultInstance) DeliverStatus() interface{}
DeliverStatus provides a data structure reflecting state of processor part for diagnostic purposes.
func (*DefaultInstance) Memory ¶
func (p *DefaultInstance) Memory() *exchange.MetricMemory
Memory gets the metric memory referenced by this processor instance
func (*DefaultInstance) ProcessMetrics ¶
func (p *DefaultInstance) ProcessMetrics(rawMetrics []plugin.MetricType)
ProcessMetrics initiates a processing run on a batch of metrics. This function engages following locks: - Lock on metric memory (ProcessorInstance.memory), - Lock on processor stats (ProcessorInstance.stats).
type Instance ¶
type Instance interface { // Config gets the system config instance referenced by this processor Config() *exchange.SystemConfig // Memory gets the metric memory instance referenced by this processor Memory() *exchange.MetricMemory // ProcessMetrics initiates a processing run on a batch of metrics. ProcessMetrics(rawMetrics []plugin.MetricType) // DeliverStatus provides a data structure reflecting state of // processor part for diagnostic purposes. DeliverStatus() interface{} }
Instance wires together all data elements required to perform metrics processing.
type MetricMap ¶
type MetricMap map[string]interface{}
MetricMap is a wrapper around map of metrics (possibly nested) allowing to parse its values into specific types
func (MetricMap) FlattenValues ¶
FlattenValues returns a new map instance with keys mapping directly to their value, so {a: {value: 5}, b: {value: -1}} becomes {a:5, b:-1}.
func (MetricMap) GetStr ¶
GetStr parses map entry as instance of string, returning defValue if entry is missing; return error if underlying value is not a string
func (MetricMap) GetTimeFromStr ¶
GetTimeFromStr parses map entry as instance of Time, parsing defValue if value is missing, and returns optional parsing errors.