stats

package
v0.0.0-...-eab4402 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stats provides types and functions to handle statistics of executed requests incl. timing, errors and content

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinishedRequests

type FinishedRequests []*request.FinishedRequest

FinishedRequests represents a list of finished requests Implements sort.Interface which allows finished requests to be sorted by total time

func (FinishedRequests) AverageTotalTime

func (f FinishedRequests) AverageTotalTime() time.Duration

AverageTotalTime returns the average total time

func (FinishedRequests) BytesPerSecond

func (f FinishedRequests) BytesPerSecond() float32

BytesPerSecond returns the number of requests per second

func (FinishedRequests) Finished

func (f FinishedRequests) Finished() time.Time

Finished returns the last finished time of all samples

func (FinishedRequests) Len

func (f FinishedRequests) Len() int

Returns the number of samples Needed by sort.Interface

func (FinishedRequests) Less

func (f FinishedRequests) Less(i, j int) bool

Compares two elements Needed by sort.Interface

func (FinishedRequests) MaxTotalTime

func (f FinishedRequests) MaxTotalTime() time.Duration

MaxTotalTime returns the maximum total time

func (FinishedRequests) MedianTotalTime

func (f FinishedRequests) MedianTotalTime() time.Duration

MedianTotalTime returns the median total which is the 50% percentile

func (FinishedRequests) MinTotalTime

func (f FinishedRequests) MinTotalTime() time.Duration

MinTotalTime returns the minimum total time.

func (FinishedRequests) NumberOfErrors

func (f FinishedRequests) NumberOfErrors() (errors int)

NumberOfErrors returns the number of samples marked as errornous

func (FinishedRequests) NumberOfKeepAliveRequests

func (f FinishedRequests) NumberOfKeepAliveRequests() (count int)

NumberOfKeepAliveRequests returns the number of requests that reused an existing TCP connection

func (FinishedRequests) NumberOfRequests

func (f FinishedRequests) NumberOfRequests() int

NumberOfRequests returns the number of samples.

func (FinishedRequests) RequestsPerSecond

func (f FinishedRequests) RequestsPerSecond() float32

RequestsPerSecond returns the number of requests per second

func (FinishedRequests) Started

func (f FinishedRequests) Started() time.Time

Started returns the first start time of all samples

func (FinishedRequests) Swap

func (f FinishedRequests) Swap(i, j int)

Swaps two elements Needed by sort.Interface

func (FinishedRequests) TotalBytes

func (f FinishedRequests) TotalBytes() int64

TotalBytes returns the total bytes received for the samples

func (FinishedRequests) TotalDuration

func (f FinishedRequests) TotalDuration() time.Duration

TotalDuration returns the overall duration of all samples

func (FinishedRequests) TotalTime

func (f FinishedRequests) TotalTime() time.Duration

TotalTime returns the total time

func (FinishedRequests) TotalTimePercentile

func (f FinishedRequests) TotalTimePercentile(percentile float32) time.Duration

TotalTimePercentile returns the given total time percentile percentile must be between 0 and 1.0

type Series

type Series struct {
	Label            string
	FinishedRequests []*request.FinishedRequest
}

Series represents a (potentially growing) set of samples Series provides operations for obtaining Stats from the samples using different groupings.

func NewSeries

func NewSeries(label string) *Series

NewSeries is a factory for creating a new Series

func (*Series) AddRequest

func (s *Series) AddRequest(req *request.FinishedRequest) *Series

AddRequest adds a single sample to the series It returns the series for invocation chaining

func (*Series) Stats

func (s *Series) Stats() Stats

Stats "freezes" the current samples of this series and returns a Stats instance for those samples. The series may be used to collect more samples.

func (*Series) StatsByURL

func (s *Series) StatsByURL() []Stats

StatsByURL groups all samples of the series by their URL and returns stats for each URL.

type Stats

type Stats struct {
	// A Label (URL most of the time) for these stats
	Label string

	// The requests
	FinishedRequests
}

Stats represents a labeled set of samples

func (*Stats) FirstNonErrorRequest

func (s *Stats) FirstNonErrorRequest() *request.FinishedRequest

FirstNonErrorRequest returns the first finished request that was successful or nil

Jump to

Keyboard shortcuts

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