Documentation ¶
Overview ¶
Package analysis provides information about the aggregated data.
Index ¶
Constants ¶
const ( // TypeReq stands for "REQ" TypeReq message = iota // TypeAck stands for "ACK" TypeAck // TypeNak stands for "NAK" TypeNak )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer will hold analysis data.
func NewAnalyzer ¶
func NewAnalyzer() *Analyzer
NewAnalyzer allocates and returns a new Analyzer, that intercepts data, and aggregates it.
func (*Analyzer) GetDataSource ¶
func (a *Analyzer) GetDataSource() Aggregation
GetDataSource returns the aggregation chanel.
func (*Analyzer) GetTimeTable ¶
GetTimeTable returns a reference to a TimeTable instance.
func (*Analyzer) MonitorData ¶
func (a *Analyzer) MonitorData()
MonitorData initiates data monitoring to be aggregated.
func (*Analyzer) RestoreTenSecCounter ¶
func (a *Analyzer) RestoreTenSecCounter(recovery *persistence.Recovery)
RestoreTenSecCounter restores the value of the 10s second counter from recovery data. Considering the time that has passed since the last failure.
func (*Analyzer) UpdateStats ¶
UpdateStats acts as a wrapper for updating TimeTable.
type Stats ¶
type Stats struct { // msg_total — total number of messages (integer) TotalMessages uint64 `json:"msg_total"` // msg_req — total number of REQ messages (integer) TotalRequests uint64 `json:"msg_req"` // msg_ack — total number of ACK messages (integer) TotalACK uint64 `json:"msg_ack"` // msg_nak — total number of NAK messages (integer) TotalNAK uint64 `json:"msg_nak"` // request_rate_1s — average REQ messages/sec, in a 1s moving window (floating point) RequestRatePerSecond float64 `json:"request_rate_1s"` // request_rate_10s — average REQ messages/sec, in a 10s moving window (floating point) RequestRatePerTenSecond float64 `json:"request_rate_10s"` // response_rate_1s — average ACK+NAK messages per second, in a 1s moving window (floating point) ResponseRatePerSecond float64 `json:"response_rate_1s"` // response_rate_10s — average ACK+NAK messages per second, in a 10s moving window (floating point) ResponseRatePerTenSecond float64 `json:"response_rate_10s"` }
Stats type acts as an interface to the data that will be exported later.
func (*Stats) CalculateAverages ¶
CalculateAverages calculates average req/response in 1s/10s.
func (*Stats) UpdateTotalCounters ¶
func (s *Stats) UpdateTotalCounters(msgType message)
UpdateTotalCounters updates total counts.
type TimeTable ¶
type TimeTable struct { // Request time log for 1 second. RequestsInOneSec [1000]uint64 // Response time log for 1 second. ResponsesInOneSec [1000]uint64 // Request time log for 10 seconds. RequestsInTenSec [10]uint64 // Response time log for 10 seconds. ResponsesInTenSec [10]uint64 // Index for one second time log array. IndexOneSec uint16 // Index for ten seconds time log array. IndexTenSec uint8 // Holds total number of requests in one second. RequestsCount uint64 // Holds total number of responses in one second. ResponsesCount uint64 }
TimeTable type holds reference for data that are updated over time.
func (*TimeTable) UpdateCounters ¶
func (t *TimeTable) UpdateCounters(msgType message)
UpdateCounters updates associated counter based on message type.