metrics

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Collector contains collected statistic while API server works

func NewMetrics

func NewMetrics() *Collector

NewMetrics create new metrics collector instance

func (*Collector) Collect

func (c *Collector) Collect(req http.Request, rt RoundTrip, isOk bool)

Collect requests result

func (*Collector) RequestDropPercentage

func (c *Collector) RequestDropPercentage() (float64, error)

RequestDropPercentage calc % of drops

func (*Collector) ToString

func (c *Collector) ToString() (out string)

ToString makes pretty print format of collected metrics

type RequestState

type RequestState struct {
	URL       string
	Method    string
	Succeeded uint32
	Failed    uint32
	Trip      RoundTrip
}

RequestState stores result of it

type RoundTrip

type RoundTrip struct {
	Start time.Time
	End   time.Time
}

RoundTrip of request to response

Jump to

Keyboard shortcuts

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