internal

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientType

type ClientType int

ClientType is the type of HTTP client used in test

const (
	// FastHTTP is fasthttp's HTTP client
	FastHTTP ClientType = iota
	// NetHTTP1 is Go's default HTTP client with forced HTTP/1.x
	NetHTTP1
	// NetHTTP2 is Go's default HTTP client with HTTP/2.0 permitted.
	NetHTTP2
)

type ErrorWithCount

type ErrorWithCount struct {
	Error string
	Count uint64
}

ErrorWithCount contains error description alongside with number of times this error occurred.

type Header struct {
	Key, Value string
}

Header represents HTTP header.

type LatenciesStats

type LatenciesStats struct {
	// These are in microseconds
	Mean   float64
	Stddev float64
	Max    float64

	// This is  map[0.0 <= p <= 1.0 (percentile)]microseconds
	Percentiles map[float64]uint64
}

LatenciesStats contains statistical information about latencies.

type ReadonlyFloat64Histogram

type ReadonlyFloat64Histogram interface {
	Get(float64) uint64
	VisitAll(func(float64, uint64) bool)
	Count() uint64
}

ReadonlyFloat64Histogram is a readonly histogram with float64 keys

type ReadonlyUint64Histogram

type ReadonlyUint64Histogram interface {
	Get(uint64) uint64
	VisitAll(func(uint64, uint64) bool)
	Count() uint64
}

ReadonlyUint64Histogram is a readonly histogram with uint64 keys

type RequestsStats

type RequestsStats struct {
	// These are in requests per second.
	Mean   float64
	Stddev float64
	Max    float64

	// This is  map[0.0 <= p <= 1.0 (percentile)](req-s per second)
	Percentiles map[float64]float64
}

RequestsStats contains statistical information about requests.

type Results

type Results struct {
	BytesRead, BytesWritten int64
	TimeTaken               time.Duration

	Req1XX, Req2XX, Req3XX, Req4XX, Req5XX uint64
	Others                                 uint64

	Errors []ErrorWithCount

	Latencies ReadonlyUint64Histogram
	Requests  ReadonlyFloat64Histogram
}

Results holds results of the test.

func (Results) LatenciesStats

func (r Results) LatenciesStats(percentiles []float64) *LatenciesStats

LatenciesStats performs various statistical calculations on latencies.

func (Results) RequestsStats

func (r Results) RequestsStats(percentiles []float64) *RequestsStats

RequestsStats performs various statistical calculations on latencies.

func (Results) Throughput

func (r Results) Throughput() float64

Throughput returns total throughput (read + write) in bytes per second

type Spec

type Spec struct {
	NumberOfConnections uint64

	TestType         TestType
	NumberOfRequests uint64
	TestDuration     time.Duration

	Method string
	URL    string

	Headers []Header

	Body         string
	BodyFilePath string

	CertPath string
	KeyPath  string

	Stream     bool
	Timeout    time.Duration
	ClientType ClientType

	Rate *uint64
}

Spec contains information about test performed.

func (Spec) IsFastHTTP

func (s Spec) IsFastHTTP() bool

IsFastHTTP tells whether fasthttp were used as HTTP client to perform the test.

func (Spec) IsNetHTTPV1

func (s Spec) IsNetHTTPV1() bool

IsNetHTTPV1 tells whether Go's default net/http library and HTTP/1.x were used to perform the test.

func (Spec) IsNetHTTPV2

func (s Spec) IsNetHTTPV2() bool

IsNetHTTPV2 tells whether Go's default net/http library and HTTP/1.x (or HTTP/2.0, if possible) were used to perform the test.

func (Spec) IsTestWithNumberOfReqs

func (s Spec) IsTestWithNumberOfReqs() bool

IsTestWithNumberOfReqs tells if the test was limited by the number of requests.

func (Spec) IsTimedTest

func (s Spec) IsTimedTest() bool

IsTimedTest tells if the test was limited by time.

type TestInfo

type TestInfo struct {
	Spec   Spec
	Result Results
}

TestInfo holds information about what specification was used to perform the test and results of the test.

type TestType

type TestType int

TestType represents the type of test that were performed.

const (

	// ByTime is a test limited by durations.
	ByTime TestType
	// ByNumberOfReqs is a test limited by number of requests
	// performed.
	ByNumberOfReqs
)

Jump to

Keyboard shortcuts

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