stat

package
v0.0.0-...-c726bdf Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stat implements a simple stats aggregator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stat

type Stat struct {
	Val int64
	Ts  time.Time
}

Stat type includes a statted value and its timestamp.

type Stats

type Stats struct {
	Aggregated chan Stat
	// contains filtered or unexported fields
}

Stats type structure enabling statting facilities.

func NewStats

func NewStats(sz uint32) (*Stats, error)

NewStats constructor for Stats

func (*Stats) Process

func (s *Stats) Process()

Process call to start processing statistics

func (*Stats) StatEvent

func (s *Stats) StatEvent(v int64)

StatEvent aggregates an event with value v

func (*Stats) Stop

func (s *Stats) Stop()

Stop call to stop processing statistics. Once stopped, Stats cannot be restarted.

func (*Stats) Update

func (s *Stats) Update(expStat *expvar.Int)

Update update the expvar parameter with the last aggregated value

Jump to

Keyboard shortcuts

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