httpstat

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPStat

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

HTTPStat is the statistics tool for HTTP traffic.

func New

func New() *HTTPStat

New creates an HTTPStat.

func (*HTTPStat) Stat

func (hs *HTTPStat) Stat(m *Metric)

Stat stats the ctx.

func (*HTTPStat) Status

func (hs *HTTPStat) Status() *Status

Status returns HTTPStat Status, It assumes it is called every five seconds. https://github.com/rcrowley/go-metrics/blob/3113b8401b8a98917cde58f8bbd42a1b1c03b1fd/ewma.go#L98-L99

type Metric

type Metric struct {
	StatusCode int
	Duration   time.Duration
	ReqSize    uint64
	RespSize   uint64
}

Metric is the package of statistics at once.

type Status

type Status struct {
	Count uint64  `yaml:"count"`
	M1    float64 `yaml:"m1"`
	M5    float64 `yaml:"m5"`
	M15   float64 `yaml:"m15"`

	ErrCount uint64  `yaml:"errCount"`
	M1Err    float64 `yaml:"m1Err"`
	M5Err    float64 `yaml:"m5Err"`
	M15Err   float64 `yaml:"m15Err"`

	M1ErrPercent  float64 `yaml:"m1ErrPercent"`
	M5ErrPercent  float64 `yaml:"m5ErrPercent"`
	M15ErrPercent float64 `yaml:"m15ErrPercent"`

	Min  uint64 `yaml:"min"`
	Max  uint64 `yaml:"max"`
	Mean uint64 `yaml:"mean"`

	P25  float64 `yaml:"p25"`
	P50  float64 `yaml:"p50"`
	P75  float64 `yaml:"p75"`
	P95  float64 `yaml:"p95"`
	P98  float64 `yaml:"p98"`
	P99  float64 `yaml:"p99"`
	P999 float64 `yaml:"p999"`

	ReqSize  uint64 `yaml:"reqSize"`
	RespSize uint64 `yaml:"respSize"`

	Codes map[int]uint64 `yaml:"codes"`
}

Status contains all status generated by HTTPStat.

Jump to

Keyboard shortcuts

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