package flow

Import Path
	github.com/libp2p/go-flow-metrics (on go.dev)

Dependency Relation
	imports 6 packages, and imported by one package

Involved Source Files meter.go registry.go sweeper.go
Package-Level Type Names (total 3)
/* sort by: | */
Meter is a meter for monitoring a flow. Mark updates the total. Reset sets accumulator, total and rate to zero. Snapshot gets a snapshot of the total and rate. (*Meter) String() string *Meter : expvar.Var *Meter : fmt.Stringer func NewMeter() *Meter func (*MeterRegistry).Get(name string) *Meter
MeterRegistry is a registry for named meters. Clear removes all meters from the registry. FindIdle finds all meters that haven't been used since the given time. ForEach calls the passed function for each registered meter. Get gets (or creates) a meter by name. Remove removes the named meter from the registry. Note: The only reason to do this is to save a bit of memory. Unused meters don't consume any CPU (after they go idle). TrimIdle trims that haven't been updated since the given time. Returns the number of timers trimmed.
Snapshot is a rate/total snapshot. LastUpdate time.Time Rate float64 Total uint64 ( Snapshot) String() string Snapshot : expvar.Var Snapshot : fmt.Stringer func (*Meter).Snapshot() Snapshot
Package-Level Functions (total 2)
NewMeter returns a new Meter with the correct idle time. While zero-value Meters can be used, their "last update" time will start at the program start instead of when the meter was created.
SetClock sets a clock to use in the sweeper. This will probably only ever be useful for testing purposes.
Package-Level Variables (only one)
IdleRate the rate at which we declare a meter idle (and stop tracking it until it's re-registered). The default ensures that 1 event every ~30s will keep the meter from going idle.