stat

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Component = &Stat{}
View Source
var RequestCounter uint64

Functions

func StartStat

func StartStat()

Types

type MainStat

type MainStat struct {
	Start          time.Time
	RequestsTotal  int            // num requests total, anything included
	LengthServed   int            // length total, anything included
	RequestsServed map[int]int    // by response code
	Requests       []*RequestStat // by microtime. keep last minute requests

	SitesStat map[string]*SiteStat // Every site stat. referenced by ID (from config)
	// contains filtered or unexported fields
}
var SystemStat *MainStat

func CreateStat

func CreateStat() *MainStat

func (*MainStat) Clean

func (s *MainStat) Clean()

type RequestStat

type RequestStat struct {
	Id        uint64
	StartTime time.Time
	Time      time.Time
	Hostname  string
	Request   string
	Referer   string
	Protocol  string
	Method    string
	Code      int
	Length    int
	Duration  time.Duration
	IP        string
	Port      string
	Alive     bool
}

func CreateRequestStat

func CreateRequestStat(request string, method string, protocol string, code int, length int, duration time.Duration, remoteaddr string, referer string) *RequestStat

func (*RequestStat) End

func (r *RequestStat) End()

func (*RequestStat) UpdateProtocol

func (r *RequestStat) UpdateProtocol(protocol string)

func (*RequestStat) UpdateStat

func (r *RequestStat) UpdateStat(code int, length int)

type SiteStat

type SiteStat struct {
	RequestsTotal  int            // num requests total, anything included
	RequestsServed map[int]int    // by response code
	LengthServed   int            // length total, anything included
	Requests       []*RequestStat // the last minute requests
}

type Stat

type Stat struct{}

func (*Stat) Handler

func (st *Stat) Handler(handler http.HandlerFunc) http.HandlerFunc

func (*Stat) NeedHandler

func (st *Stat) NeedHandler() bool

func (*Stat) Start

func (st *Stat) Start()

func (*Stat) StartHost added in v1.5.1

func (st *Stat) StartHost(host *config.Host)

Jump to

Keyboard shortcuts

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