report

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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

func (reporter *Reporter) PrintReport(writer io.Writer)

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) Run

func (reporter *Reporter) Run()

Run runs the Reporter goroutines.

func (*Reporter) TotalLoadReportedTillNow

func (reporter *Reporter) TotalLoadReportedTillNow() uint64

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.

type SubjectServerResponse

type SubjectServerResponse struct {
	Err                error
	ResponseTime       time.Time
	PayloadLengthBytes int64
}

SubjectServerResponse represents the response read from the target server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL