stats

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SortCount                   = "Count"
	SortUri                     = "Uri"
	SortMethod                  = "Method"
	SortMaxResponseTime         = "MaxResponseTime"
	SortMinResponseTime         = "MinResponseTime"
	SortSumResponseTime         = "SumResponseTime"
	SortAvgResponseTime         = "AvgResponseTime"
	SortPNResponseTime          = "PNResponseTime"
	SortStddevResponseTime      = "StddevResponseTime"
	SortMaxRequestBodyBytes     = "MaxRequestBodyBytes"
	SortMinRequestBodyBytes     = "MinRequestBodyBytes"
	SortSumRequestBodyBytes     = "SumRequestBodyBytes"
	SortAvgRequestBodyBytes     = "AvgRequestBodyBytes"
	SortPNRequestBodyBytes      = "PNRequestBodyBytes"
	SortStddevRequestBodyBytes  = "StddevRequestBodyBytes"
	SortMaxResponseBodyBytes    = "MaxResponseBodyBytes"
	SortMinResponseBodyBytes    = "MinResponseBodyBytes"
	SortSumResponseBodyBytes    = "SumResponseBodyBytes"
	SortAvgResponseBodyBytes    = "AvgResponseBodyBytes"
	SortPNResponseBodyBytes     = "PNResponseBodyBytes"
	SortStddevResponseBodyBytes = "StddevResponseBodyBytes"
)

Variables

This section is empty.

Functions

func BetweenTime

func BetweenTime(t, start, end string) bool

func DiffCountAll added in v1.0.10

func DiffCountAll(from, to map[string]int) map[string]string

func StringTimeEqualTime

func StringTimeEqualTime(l string, r time.Time) bool

=

func StringTimeGreaterThanOrEqualTime

func StringTimeGreaterThanOrEqualTime(l string, r time.Time) bool

>=

func StringTimeGreaterThanTime

func StringTimeGreaterThanTime(l string, r time.Time) bool

>

func StringTimeLessThanOrEqualTime

func StringTimeLessThanOrEqualTime(l string, r time.Time) bool

<=

func StringTimeLessThanTime

func StringTimeLessThanTime(l string, r time.Time) bool

<

func StringTimeNotEqualTime

func StringTimeNotEqualTime(l string, r time.Time) bool

!=

func TimeAgo

func TimeAgo(s string) time.Time

func TimeStringEqualTime

func TimeStringEqualTime(l time.Time, r string) bool

=

func TimeStringGreaterThanOrEqualTime

func TimeStringGreaterThanOrEqualTime(l time.Time, r string) bool

>=

func TimeStringGreaterThanTime

func TimeStringGreaterThanTime(l time.Time, r string) bool

>

func TimeStringLessThanOrEqualTime

func TimeStringLessThanOrEqualTime(l time.Time, r string) bool

<=

func TimeStringLessThanTime

func TimeStringLessThanTime(l time.Time, r string) bool

<

func TimeStringNotEqualTime

func TimeStringNotEqualTime(l time.Time, r string) bool

!=

Types

type Differ added in v1.0.10

type Differ struct {
	From *HTTPStat
	To   *HTTPStat
}

func NewDiffer added in v1.0.10

func NewDiffer(from, to *HTTPStat) *Differ

func (*Differ) DiffAvgRequestBodyBytes added in v1.0.10

func (d *Differ) DiffAvgRequestBodyBytes() string

func (*Differ) DiffAvgResponseBodyBytes added in v1.0.10

func (d *Differ) DiffAvgResponseBodyBytes() string

func (*Differ) DiffAvgResponseTime added in v1.0.10

func (d *Differ) DiffAvgResponseTime() string

func (*Differ) DiffCnt added in v1.0.10

func (d *Differ) DiffCnt() string

func (*Differ) DiffMaxRequestBodyBytes added in v1.0.10

func (d *Differ) DiffMaxRequestBodyBytes() string

request

func (*Differ) DiffMaxResponseBodyBytes added in v1.0.10

func (d *Differ) DiffMaxResponseBodyBytes() string

response

func (*Differ) DiffMaxResponseTime added in v1.0.10

func (d *Differ) DiffMaxResponseTime() string

func (*Differ) DiffMinRequestBodyBytes added in v1.0.10

func (d *Differ) DiffMinRequestBodyBytes() string

func (*Differ) DiffMinResponseBodyBytes added in v1.0.10

func (d *Differ) DiffMinResponseBodyBytes() string

func (*Differ) DiffMinResponseTime added in v1.0.10

func (d *Differ) DiffMinResponseTime() string

func (*Differ) DiffPNRequestBodyBytes added in v1.0.10

func (d *Differ) DiffPNRequestBodyBytes(n int) string

func (*Differ) DiffPNResponseBodyBytes added in v1.0.10

func (d *Differ) DiffPNResponseBodyBytes(n int) string

func (*Differ) DiffPNResponseTime added in v1.0.10

func (d *Differ) DiffPNResponseTime(n int) string

func (*Differ) DiffStatus1xx added in v1.0.10

func (d *Differ) DiffStatus1xx() string

func (*Differ) DiffStatus2xx added in v1.0.10

func (d *Differ) DiffStatus2xx() string

func (*Differ) DiffStatus3xx added in v1.0.10

func (d *Differ) DiffStatus3xx() string

func (*Differ) DiffStatus4xx added in v1.0.10

func (d *Differ) DiffStatus4xx() string

func (*Differ) DiffStatus5xx added in v1.0.10

func (d *Differ) DiffStatus5xx() string

func (*Differ) DiffStddevRequestBodyBytes added in v1.0.10

func (d *Differ) DiffStddevRequestBodyBytes() string

func (*Differ) DiffStddevResponseBodyBytes added in v1.0.10

func (d *Differ) DiffStddevResponseBodyBytes() string

func (*Differ) DiffStddevResponseTime added in v1.0.10

func (d *Differ) DiffStddevResponseTime() string

func (*Differ) DiffSumRequestBodyBytes added in v1.0.10

func (d *Differ) DiffSumRequestBodyBytes() string

func (*Differ) DiffSumResponseBodyBytes added in v1.0.10

func (d *Differ) DiffSumResponseBodyBytes() string

func (*Differ) DiffSumResponseTime added in v1.0.10

func (d *Differ) DiffSumResponseTime() string

type ExpEval

type ExpEval struct {
	// contains filtered or unexported fields
}

func NewExpEval

func NewExpEval(input string, pt parsetime.ParseTime) (*ExpEval, error)

func (*ExpEval) Run

func (ee *ExpEval) Run(stat *parsers.ParsedHTTPStat) (bool, error)

type ExpEvalEnv

type ExpEvalEnv struct {
	Uri                              string
	Method                           string
	Time                             string
	ResponseTime                     float64
	BodyBytes                        float64
	Status                           int
	TimeStringEqualTime              func(l time.Time, r string) bool
	TimeStringNotEqualTime           func(l time.Time, r string) bool
	TimeStringGreaterThanTime        func(l time.Time, r string) bool
	TimeStringGreaterThanOrEqualTime func(l time.Time, r string) bool
	TimeStringLessThanTime           func(l time.Time, r string) bool
	TimeStringLessThanOrEqualTime    func(l time.Time, r string) bool
	StringTimeEqualTime              func(l string, r time.Time) bool
	StringTimeNotEqualTime           func(l string, r time.Time) bool
	StringTimeGreaterThanTime        func(l string, r time.Time) bool
	StringTimeGreaterThanOrEqualTime func(l string, r time.Time) bool
	StringTimeLessThanTime           func(l string, r time.Time) bool
	StringTimeLessThanOrEqualTime    func(l string, r time.Time) bool
	TimeAgo                          func(s string) time.Time
	BetweenTime                      func(t, start, end string) bool
}

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(options *options.Options) *Filter

func (*Filter) Do

func (f *Filter) Do(stat *parsers.ParsedHTTPStat) error

func (*Filter) Init

func (f *Filter) Init() error

func (*Filter) InitParseTime

func (f *Filter) InitParseTime(loc string) error

func (*Filter) ParseTime

func (f *Filter) ParseTime(val string) (time.Time, error)

func (*Filter) TimeStrToUnixNano

func (f *Filter) TimeStrToUnixNano(val string) (int64, error)

type HTTPStat

type HTTPStat struct {
	Uri               string        `yaml:"uri"`
	Cnt               int           `yaml:"count"`
	Status1xx         int           `yaml:"status1xx"`
	Status2xx         int           `yaml:"status2xx"`
	Status3xx         int           `yaml:"status3xx"`
	Status4xx         int           `yaml:"status4xx"`
	Status5xx         int           `yaml:"status5xx"`
	Method            string        `yaml:"method"`
	ResponseTime      *responseTime `yaml:"response_time"`
	RequestBodyBytes  *bodyBytes    `yaml:"request_body_bytes"`
	ResponseBodyBytes *bodyBytes    `yaml:"response_body_bytes"`
	Time              string
}

func (*HTTPStat) AvgRequestBodyBytes

func (hs *HTTPStat) AvgRequestBodyBytes() float64

func (*HTTPStat) AvgResponseBodyBytes

func (hs *HTTPStat) AvgResponseBodyBytes() float64

func (*HTTPStat) AvgResponseTime

func (hs *HTTPStat) AvgResponseTime() float64

func (*HTTPStat) Count

func (hs *HTTPStat) Count() int

func (*HTTPStat) MaxRequestBodyBytes

func (hs *HTTPStat) MaxRequestBodyBytes() float64

request

func (*HTTPStat) MaxResponseBodyBytes

func (hs *HTTPStat) MaxResponseBodyBytes() float64

response

func (*HTTPStat) MaxResponseTime

func (hs *HTTPStat) MaxResponseTime() float64

func (*HTTPStat) MinRequestBodyBytes

func (hs *HTTPStat) MinRequestBodyBytes() float64

func (*HTTPStat) MinResponseBodyBytes

func (hs *HTTPStat) MinResponseBodyBytes() float64

func (*HTTPStat) MinResponseTime

func (hs *HTTPStat) MinResponseTime() float64

func (*HTTPStat) PNRequestBodyBytes added in v1.0.4

func (hs *HTTPStat) PNRequestBodyBytes(n int) float64

func (*HTTPStat) PNResponseBodyBytes added in v1.0.4

func (hs *HTTPStat) PNResponseBodyBytes(n int) float64

func (*HTTPStat) PNResponseTime added in v1.0.4

func (hs *HTTPStat) PNResponseTime(n int) float64

func (*HTTPStat) Set

func (hs *HTTPStat) Set(status int, restime, reqBodyBytes, resBodyBytes float64)

func (*HTTPStat) StddevRequestBodyBytes

func (hs *HTTPStat) StddevRequestBodyBytes() float64

func (*HTTPStat) StddevResponseBodyBytes

func (hs *HTTPStat) StddevResponseBodyBytes() float64

func (*HTTPStat) StddevResponseTime

func (hs *HTTPStat) StddevResponseTime() float64

func (*HTTPStat) StrCount

func (hs *HTTPStat) StrCount() string

func (*HTTPStat) StrStatus1xx

func (hs *HTTPStat) StrStatus1xx() string

func (*HTTPStat) StrStatus2xx

func (hs *HTTPStat) StrStatus2xx() string

func (*HTTPStat) StrStatus3xx

func (hs *HTTPStat) StrStatus3xx() string

func (*HTTPStat) StrStatus4xx

func (hs *HTTPStat) StrStatus4xx() string

func (*HTTPStat) StrStatus5xx

func (hs *HTTPStat) StrStatus5xx() string

func (*HTTPStat) SumRequestBodyBytes

func (hs *HTTPStat) SumRequestBodyBytes() float64

func (*HTTPStat) SumResponseBodyBytes

func (hs *HTTPStat) SumResponseBodyBytes() float64

func (*HTTPStat) SumResponseTime

func (hs *HTTPStat) SumResponseTime() float64

func (*HTTPStat) UriWithOptions added in v1.0.5

func (hs *HTTPStat) UriWithOptions(decode bool) string

type HTTPStats

type HTTPStats struct {
	// contains filtered or unexported fields
}

func NewHTTPStats

func NewHTTPStats(useResTimePercentile, useRequestBodyBytesPercentile, useResponseBodyBytesPercentile bool) *HTTPStats

func (*HTTPStats) CountAll

func (hs *HTTPStats) CountAll() map[string]int

func (*HTTPStats) CountUris

func (hs *HTTPStats) CountUris() int

func (*HTTPStats) DoFilter

func (hs *HTTPStats) DoFilter(pstat *parsers.ParsedHTTPStat) (bool, error)

func (*HTTPStats) DumpStats

func (hs *HTTPStats) DumpStats(w io.Writer) error

func (*HTTPStats) InitFilter

func (hs *HTTPStats) InitFilter(options *options.Options) error

func (*HTTPStats) LoadStats

func (hs *HTTPStats) LoadStats(r io.Reader) error

func (*HTTPStats) Set

func (hs *HTTPStats) Set(uri, method string, status int, restime, resBodyBytes, reqBodyBytes float64)

func (*HTTPStats) SetOptions

func (hs *HTTPStats) SetOptions(options *options.Options)

func (*HTTPStats) SetSortOptions added in v1.0.4

func (hs *HTTPStats) SetSortOptions(options *SortOptions)

func (*HTTPStats) SetURIMatchingGroups

func (hs *HTTPStats) SetURIMatchingGroups(groups []string) error

func (*HTTPStats) Sort

func (hs *HTTPStats) Sort(sortOptions *SortOptions, reverse bool)

func (*HTTPStats) SortAvgRequestBodyBytes

func (hs *HTTPStats) SortAvgRequestBodyBytes(reverse bool)

func (*HTTPStats) SortAvgResponseBodyBytes

func (hs *HTTPStats) SortAvgResponseBodyBytes(reverse bool)

func (*HTTPStats) SortAvgResponseTime

func (hs *HTTPStats) SortAvgResponseTime(reverse bool)

func (*HTTPStats) SortCount

func (hs *HTTPStats) SortCount(reverse bool)

func (*HTTPStats) SortMaxRequestBodyBytes

func (hs *HTTPStats) SortMaxRequestBodyBytes(reverse bool)

request

func (*HTTPStats) SortMaxResponseBodyBytes

func (hs *HTTPStats) SortMaxResponseBodyBytes(reverse bool)

response

func (*HTTPStats) SortMaxResponseTime

func (hs *HTTPStats) SortMaxResponseTime(reverse bool)

func (*HTTPStats) SortMethod

func (hs *HTTPStats) SortMethod(reverse bool)

func (*HTTPStats) SortMinRequestBodyBytes

func (hs *HTTPStats) SortMinRequestBodyBytes(reverse bool)

func (*HTTPStats) SortMinResponseBodyBytes

func (hs *HTTPStats) SortMinResponseBodyBytes(reverse bool)

func (*HTTPStats) SortMinResponseTime

func (hs *HTTPStats) SortMinResponseTime(reverse bool)

func (*HTTPStats) SortPNRequestBodyBytes added in v1.0.4

func (hs *HTTPStats) SortPNRequestBodyBytes(reverse bool)

func (*HTTPStats) SortPNResponseBodyBytes added in v1.0.4

func (hs *HTTPStats) SortPNResponseBodyBytes(reverse bool)

func (*HTTPStats) SortPNResponseTime added in v1.0.4

func (hs *HTTPStats) SortPNResponseTime(reverse bool)

func (*HTTPStats) SortStddevRequestBodyBytes

func (hs *HTTPStats) SortStddevRequestBodyBytes(reverse bool)

func (*HTTPStats) SortStddevResponseBodyBytes

func (hs *HTTPStats) SortStddevResponseBodyBytes(reverse bool)

func (*HTTPStats) SortStddevResponseTime

func (hs *HTTPStats) SortStddevResponseTime(reverse bool)

func (*HTTPStats) SortSumRequestBodyBytes

func (hs *HTTPStats) SortSumRequestBodyBytes(reverse bool)

func (*HTTPStats) SortSumResponseBodyBytes

func (hs *HTTPStats) SortSumResponseBodyBytes(reverse bool)

func (*HTTPStats) SortSumResponseTime

func (hs *HTTPStats) SortSumResponseTime(reverse bool)

func (*HTTPStats) SortUri

func (hs *HTTPStats) SortUri(reverse bool)

func (*HTTPStats) SortWithOptions

func (hs *HTTPStats) SortWithOptions()

func (*HTTPStats) Stats

func (hs *HTTPStats) Stats() []*HTTPStat

type PrintOptions added in v1.0.5

type PrintOptions struct {
	// contains filtered or unexported fields
}

func NewPrintOptions added in v1.0.5

func NewPrintOptions(noHeaders, showFooters, decodeUri bool, paginationLimit int) *PrintOptions

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

func NewPrinter

func NewPrinter(w io.Writer, val, format string, percentiles []int, printOptions *PrintOptions) *Printer

func (*Printer) GenerateFooter

func (p *Printer) GenerateFooter(counts map[string]int) []string

func (*Printer) GenerateFooterWithDiff added in v1.0.10

func (p *Printer) GenerateFooterWithDiff(countsFrom, countsTo map[string]int) []string

func (*Printer) GenerateLine

func (p *Printer) GenerateLine(s *HTTPStat, quoteUri bool) []string

func (*Printer) GenerateLineWithDiff added in v1.0.10

func (p *Printer) GenerateLineWithDiff(from, to *HTTPStat, quoteUri bool) []string

func (*Printer) Print

func (p *Printer) Print(hs, hsTo *HTTPStats)

func (*Printer) SetFormat

func (p *Printer) SetFormat(format string)

func (*Printer) SetHeaders

func (p *Printer) SetHeaders(headers []string)

func (*Printer) SetWriter

func (p *Printer) SetWriter(w io.Writer)

func (*Printer) Validate

func (p *Printer) Validate() error

type SortOptions added in v1.0.4

type SortOptions struct {
	// contains filtered or unexported fields
}

func NewSortOptions added in v1.0.4

func NewSortOptions() *SortOptions

func (*SortOptions) Percentile added in v1.0.4

func (so *SortOptions) Percentile() int

func (*SortOptions) SetAndValidate added in v1.0.4

func (so *SortOptions) SetAndValidate(opt string) error

func (*SortOptions) SortType added in v1.0.4

func (so *SortOptions) SortType() string

Jump to

Keyboard shortcuts

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