Documentation
¶
Overview ¶
Package analysis implements accumulation of individual operations into summary statistics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct { // A Logger instance for debugging. No logging is done if nil. Logger log.Logger // contains filtered or unexported fields }
Pool tracks datastore activity by hashing inputs to fixed workers. The number of workers is determined when the Pool is created. The implementation prioritizes responsiveness over consistency, and data is dropped if the rate of input is too high to be handled by the Pool.
func New ¶
New returns a new Pool.
numWorkers determines the number of workers to hotlists to create. More workers gives more potential parallelism and performance, but increased memory consumption.
reportSize determines the number of entries returned from Report.
func (*Pool) HandleEvents ¶
HandleEvents adds records for a set of datastore operations to the Pool.
The events will be dispatched to their assigned workers. If a worker is overloaded, all inputs for that worker will be discarded and statistics for this Pool updated to reflect the lost data.
HandleEvents is threadsafe.
func (*Pool) Report ¶
Report returns a summary of activity recorded in this Pool since the last call to Reset.
The returned report does not represent a consistent snapshot since information is collected from workers concurrent with new information coming in.
If shouldReset is true, then a best effort will be made to clear data in the Pool while building the report. Since clearing data is an asynchronous operation across the workers in the pool, some information may be carried over between successive reports, and some data may be lost entirely.
func (*Pool) Reset ¶
func (p *Pool) Reset()
Reset clears all recorded activity from this Pool. This operation is asynchronous, and may still be in progress when Reset returns. New data added by calling HandleGetResponse after Reset returns may be lost, and results from Report immediately after a call to Reset may still contain some information recorded before the call to Reset.
func (*Pool) SetFilterPattern ¶
SetFilterPattern sets an RE2 pattern for future data points. Only operations on keys matching pattern will have statistics collected. Setting a new filter invalidates existing results, so current statistics are cleared before returning. If pattern is the empty string statistics are collected for all keys.
type Report ¶
type Report struct { // when this report was generated Timestamp time.Time KeyColNames []string ValColNames []string Rows []ReportRow }
Report represents key activity submitted to a Pool since the last call to Reset.