stats

package
v0.0.0-...-8e4f697 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2013 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountTracker

type CountTracker interface {
	Counts() map[string]int64
}

type Counters

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

func NewCounters

func NewCounters(name string) *Counters

func (*Counters) Add

func (c *Counters) Add(name string, value int64)

func (*Counters) Counts

func (c *Counters) Counts() map[string]int64

func (*Counters) String

func (c *Counters) String() string

type Histogram

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

func NewGenericHistogram

func NewGenericHistogram(name string, cutoffs []int64, labels []string, countLabel, totalLabel string) *Histogram

func NewHistogram

func NewHistogram(name string, cutoffs []int64) *Histogram

func (*Histogram) Add

func (h *Histogram) Add(value int64)

func (*Histogram) Count

func (h *Histogram) Count() (count int64)

func (*Histogram) MarshalJSON

func (h *Histogram) MarshalJSON() ([]byte, error)

func (*Histogram) String

func (h *Histogram) String() string

type Rates

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

func NewRates

func NewRates(name string, countTracker CountTracker, samples int, interval time.Duration) *Rates

func (*Rates) String

func (rt *Rates) String() string

func (*Rates) Track

func (rt *Rates) Track()

type RingInt64

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

Ring of int64 values Not thread safe

func NewRingInt64

func NewRingInt64(capacity int) *RingInt64

func (*RingInt64) Add

func (ri *RingInt64) Add(val int64)

func (*RingInt64) Values

func (ri *RingInt64) Values() (values []int64)

type States

type States struct {
	// set at construction time
	StateCount int
	Labels     []string

	CurrentState          int
	CurrentStateStartTime time.Time // when we switched to our state

	// historical data about the states
	Durations   []time.Duration // how much time in each state
	Transitions []int           // how many times we got into a state
	// contains filtered or unexported fields
}

The States structure keeps historical data about a state machine state, and exports them using expvar: - our current state - how long we have been in each state - how many times we transitioned into a state (not counting initial state)

func NewStates

func NewStates(name string, labels []string, startTime time.Time, initialState int) *States

func (*States) SetState

func (s *States) SetState(state int)

func (*States) SetStateAt

func (s *States) SetStateAt(state int, now time.Time)

now has to be increasing, or we panic. Usually, only one execution thread can change a state, and therefore just using time.now() will be enough

func (*States) String

func (s *States) String() string

expvar.Var interface just call StringAt(now)

func (*States) StringAt

func (s *States) StringAt(now time.Time) string

type StrFunc

type StrFunc func() string

StrFunc converts any function that returns a JSON string into an expvar.Var compatible object.

func (StrFunc) String

func (f StrFunc) String() string

type Timings

type Timings struct {
	TotalCount int64
	TotalTime  int64
	Histograms map[string]*Histogram
	// contains filtered or unexported fields
}

func NewTimings

func NewTimings(name string) *Timings

func (*Timings) Add

func (t *Timings) Add(name string, elapsed time.Duration)

func (*Timings) Counts

func (t *Timings) Counts() map[string]int64

func (*Timings) Record

func (t *Timings) Record(name string, startTime time.Time)

func (*Timings) String

func (t *Timings) String() string

Jump to

Keyboard shortcuts

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