Documentation
¶
Index ¶
Constants ¶
const NilConnectionId int = -1
NilConnectionId represents the connection id for an unestablished connection.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadGenerationResponse ¶
type LoadGenerationResponse struct { Err error PayloadLengthBytes int64 LoadGenerationTime time.Time ConnectionId int }
LoadGenerationResponse represents the load generated on the target server.
type LoadMetrics ¶
type LoadMetrics struct { TotalRequests uint SuccessCount uint ErrorCount uint ErrorCountByType map[string]uint TotalConnections uint TotalPayloadLengthBytes int64 AveragePayloadLengthBytes int64 EarliestSuccessfulLoadSendTime time.Time LatestSuccessfulLoadSendTime time.Time TotalTime time.Duration // contains filtered or unexported fields }
type Report ¶
type Report struct { Load LoadMetrics Response ResponseMetrics }
Report reports represents the report that is displayed to the user after the load is completed. Report contains LoadMetrics and ResponseMetrics. LoadMetrics defines fields that are relevant to the generated load, whereas ResponseMetrics defines the fields that are relevant to the response read by blast. ResponseMetrics is only captured if NewResponseMetricsCollectingReporter method is called.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter generates the report. It is implemented as two goroutines, one that listens to the loadGenerationChannel and other that listens to the responseChannel. One goroutine populates the LoadMetrics, and the other goroutine populates the ResponseMetrics.
func NewLoadGenerationMetricsCollectingReporter ¶
func NewLoadGenerationMetricsCollectingReporter( loadGenerationChannel chan LoadGenerationResponse, ) *Reporter
NewLoadGenerationMetricsCollectingReporter creates a new Reporter that only populates the LoadMetrics.
func NewResponseMetricsCollectingReporter ¶
func NewResponseMetricsCollectingReporter( loadGenerationChannel chan LoadGenerationResponse, responseChannel chan SubjectServerResponse, ) *Reporter
NewResponseMetricsCollectingReporter creates a new Reporter that populates both the LoadMetrics and ResponseMetrics.
func (*Reporter) PrintReport ¶
PrintReport prints the report on the provided io.Writer. Before the report is ready to be printed, PrintReport waits for the goroutines to finish. This method can only be called after the loadGenerationChannel and responseChannel are closed.
func (*Reporter) TotalLoadReportedTillNow ¶
TotalLoadReportedTillNow returns the total load that has reporter so far.
type ResponseMetrics ¶
type ResponseMetrics struct { TotalResponses uint SuccessCount uint ErrorCount uint ErrorCountByType map[string]uint TotalResponsePayloadLengthBytes int64 AverageResponsePayloadLengthBytes int64 EarliestSuccessfulResponseReceivedTime time.Time LatestSuccessfulResponseReceivedTime time.Time IsAvailableForReporting bool TotalTime time.Duration }
type ResponseReader ¶
type ResponseReader struct {
// contains filtered or unexported fields
}
ResponseReader reads the response from the specified net.Conn.
func NewResponseReader ¶
func NewResponseReader( responseSizeBytes int64, readDeadline time.Duration, responseChannel chan SubjectServerResponse, ) *ResponseReader
NewResponseReader creates a new instance of ResponseReader. All the read responses are sent to responseChannel.
func (*ResponseReader) Close ¶
func (responseReader *ResponseReader) Close()
Close closes the stopChannel which stops all the goroutines.
func (*ResponseReader) StartReading ¶
func (responseReader *ResponseReader) StartReading(connection net.Conn)
StartReading runs a goroutine that reads from the provided net.Conn. It keeps on reading from the connection until either of the two happen: 1) Reading from the connection returns an io.EOF error 2) ResponseReader gets stopped ResponseReader implements one goroutine for each new connection created by the workers.WorkerGroup.
func (*ResponseReader) TotalResponsesRead ¶
func (responseReader *ResponseReader) TotalResponsesRead() uint64
TotalResponsesRead returns the total responses read from the target server. It includes successful and failed responses.
func (*ResponseReader) TotalSuccessfulResponsesRead ¶
func (responseReader *ResponseReader) TotalSuccessfulResponsesRead() uint64
TotalSuccessfulResponsesRead returns the total successful responses read from the target server.