Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInHighTrafficState is the error returned when the listener is has previously reported that there's high traffic ErrInHighTrafficState = errors.New("Already in high traffic state") // ErrLowTrafficState is the error returned when the threhold for requests per second hasn't been met ErrLowTrafficState = errors.New("Low traffic state") )
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
// contains filtered or unexported fields
}
Alert is a Listener that will output summary reports
func NewAlertListener ¶
NewAlertListener returns an Alert listener with the specified requests per second threshold. TODO: Defaults to a 2 minute threshold interval, should this be configurable?
type Listener ¶
type Listener interface { // Start should start listening on the supplied log channel and return an OutputChannel // that the caller will listen and typically output that to somewhere Start(log.Channel) (recv OutputChannel) }
Listener is an interface for listening to a log Channel and providing a channel that it will output to
type OutputChannel ¶
type OutputChannel chan string
OutputChannel is a channel that accepts strings.
type Summary ¶
type Summary struct {
// contains filtered or unexported fields
}
Summary is a Listener that will output summary reports
func NewSummaryListener ¶
func NewSummaryListener() Summary
NewSummaryListener returns an Summary listener that will report every 10 seconds TODO: Defaults to a 10 seconds trigger interval, should this be configurable?
func (*Summary) Report ¶
func (s *Summary) Report() (report SummaryReport, err error)
Report returns the summary report during based on what's currently in the logs
type SummaryReport ¶
type SummaryReport struct { Section SummaryReportItem MostActiveUser SummaryReportItem Error4XX SummaryReportItem Error5XX SummaryReportItem }
SummaryReport is the data structure that holds all the information for the report
func (SummaryReport) String ¶
func (sr SummaryReport) String() string
type SummaryReportItem ¶
SummaryReportItem ...