Documentation ¶
Index ¶
- Variables
- type ActionStats
- type ActionStatsMap
- type Collector
- func (collector *Collector) ActionsLen() int
- func (collector *Collector) CreatedApps() uint64
- func (collector *Collector) ForEachAction(f func(stats *ActionStats))
- func (collector *Collector) ForEachRequest(f func(stats *RequestStats))
- func (collector *Collector) GetOrAddActionStats(name, label, appGUID string) *ActionStats
- func (collector *Collector) GetOrAddRequestStats(method, path string) *RequestStats
- func (collector *Collector) IncCreatedApps()
- func (collector *Collector) IncOpenedApps()
- func (collector *Collector) IsFull() bool
- func (collector *Collector) IsOn() bool
- func (collector *Collector) OpenedApps() uint64
- func (collector *Collector) RESTRequestLen() int
- func (collector *Collector) SetLevel(level StatsLevel) error
- type ErrWarn
- type ExecutionCounters
- type RequestStats
- type RequestStatsMap
- type SampleCollector
- type StatsLevel
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultHotBuffer, default size of hot buffer DefaultHotBuffer = 300 // todo investigate good value // DefaultPurgeExpiry, default time until hot buffer will be purged DefaultPurgeExpiry = time.Second * 5 )
Functions ¶
This section is empty.
Types ¶
type ActionStats ¶
type ActionStats struct { // RespAvg average response time for successful actions RespAvg *SampleCollector // Requests total count of requests sent within action Requests atomichandlers.AtomicCounter // ErrCount total amount of errors within action ErrCount atomichandlers.AtomicCounter // WarnCount total amount of warnings within action WarnCount atomichandlers.AtomicCounter // Sent total amount of sent bytes Sent atomichandlers.AtomicCounter // Received total amount of received bytes Received atomichandlers.AtomicCounter // Failed total amount of failed actions, can be compared with RespAvg.count for success rate Failed atomichandlers.AtomicCounter // contains filtered or unexported fields }
ActionStats statistics collector for an Action
func NewActionStats ¶
func NewActionStats(name, label, appGUID string) *ActionStats
NewActionStats creates a new action statistics collector
func (*ActionStats) AppGUID ¶
func (action *ActionStats) AppGUID() string
AppGUID in which action was performed
type ActionStatsMap ¶
type ActionStatsMap map[string]*ActionStats
type Collector ¶
type Collector struct { Actions ActionStatsMap RestRequests RequestStatsMap Level StatsLevel // contains filtered or unexported fields }
Collector of statistics
func (*Collector) ActionsLen ¶ added in v0.5.4
ActionsLen length of action stats map of collector
func (*Collector) CreatedApps ¶ added in v0.5.4
CreatedApps total apps created count
func (*Collector) ForEachAction ¶
func (collector *Collector) ForEachAction(f func(stats *ActionStats))
ForEachAction read lock map and execute function for each ActionStats entry
func (*Collector) ForEachRequest ¶
func (collector *Collector) ForEachRequest(f func(stats *RequestStats))
ForEachRequest read lock map and execute function for each RequestStats entry
func (*Collector) GetOrAddActionStats ¶
func (collector *Collector) GetOrAddActionStats(name, label, appGUID string) *ActionStats
GetOrAddActionStats from action map, returns nil if statistics is turned off
func (*Collector) GetOrAddRequestStats ¶
func (collector *Collector) GetOrAddRequestStats(method, path string) *RequestStats
GetOrAddRequestStats from REST request map, returns nil if StatsLevel is lower than "full"
func (*Collector) IncCreatedApps ¶ added in v0.5.4
func (collector *Collector) IncCreatedApps()
IncCreatedApps increase total created apps counted by one
func (*Collector) IncOpenedApps ¶ added in v0.5.4
func (collector *Collector) IncOpenedApps()
IncOpenedApps increase total opened apps counted by one
func (*Collector) OpenedApps ¶ added in v0.5.4
OpenedApps total opened apps counted
func (*Collector) RESTRequestLen ¶ added in v0.5.4
RESTRequestLen length of REST requests stats map of collector
func (*Collector) SetLevel ¶
func (collector *Collector) SetLevel(level StatsLevel) error
SetLevel of statistics collected
type ErrWarn ¶
type ErrWarn struct {
// contains filtered or unexported fields
}
ErrWarn keeps track of errors and warnings within action + total
func (*ErrWarn) TotWarnings ¶
TotWarnings report total warnings count
type ExecutionCounters ¶ added in v0.5.4
type ExecutionCounters struct { // Threads - Total started threads Threads atomichandlers.AtomicCounter // Sessions - Total started sessions Sessions atomichandlers.AtomicCounter // Users - Total unique users Users atomichandlers.AtomicCounter // Errors - Total errors Errors atomichandlers.AtomicCounter // Warnings - Total warnings Warnings atomichandlers.AtomicCounter // ActionID - Unique global action id ActionID atomichandlers.AtomicCounter // Requests - Total requests sent Requests atomichandlers.AtomicCounter // ActiveUsers - Currently active users ActiveUsers atomichandlers.AtomicCounter // AppCounter - App counter for round robin access AppCounter atomichandlers.AtomicCounter // RestRequestID - Added to REST traffic log to connect Request and Response RestRequestID atomichandlers.AtomicCounter // StatisticsCollector optional collection of statistics StatisticsCollector *Collector }
ExecutionCounters counts values during a execution
type RequestStats ¶
type RequestStats struct { RespAvg *SampleCollector Sent atomichandlers.AtomicCounter Received atomichandlers.AtomicCounter // contains filtered or unexported fields }
RequestStats statistics collector for a REST request
func NewRequestStats ¶
func NewRequestStats(method, path string) *RequestStats
NewRequestStats creates a new REST request statistics collector
type RequestStatsMap ¶
type RequestStatsMap map[string]*RequestStats
type SampleCollector ¶
type SampleCollector struct {
// contains filtered or unexported fields
}
func NewSampleCollector ¶
func NewSampleCollector() *SampleCollector
NewSampleCollector for collecting running average
func NewSampleCollectorBuf ¶
func NewSampleCollectorBuf(buf int) *SampleCollector
NewSampleCollector for collecting running average with custom hot buffer size
func (*SampleCollector) AddSample ¶
func (collector *SampleCollector) AddSample(sample uint64)
AddSample add new sample
func (*SampleCollector) Average ¶
func (collector *SampleCollector) Average() (float64, float64)
Average empties hot buffer and calculates current running average, returns average, total samples.
type StatsLevel ¶
type StatsLevel int
const ( StatsLevelNone StatsLevel = iota StatsLevelOn StatsLevelFull )
StatsLevel enum