memstats

package
v0.0.0-...-ca02393 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measurement

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

func (*Measurement) Count

func (m *Measurement) Count(n int)

Count implements stats.Measurement

func (*Measurement) Durations

func (m *Measurement) Durations() []time.Duration

func (*Measurement) Gauge

func (m *Measurement) Gauge(value interface{})

Gauge implements stats.Measurement

func (*Measurement) Increment

func (m *Measurement) Increment()

Increment implements stats.Measurement

func (*Measurement) LastDuration

func (m *Measurement) LastDuration() time.Duration

func (*Measurement) LastValue

func (m *Measurement) LastValue() float64

func (*Measurement) Observe

func (m *Measurement) Observe(value float64)

Observe implements stats.Measurement

func (*Measurement) RecordDuration

func (m *Measurement) RecordDuration() func()

RecordDuration implements stats.Measurement

func (*Measurement) SendTiming

func (m *Measurement) SendTiming(duration time.Duration)

SendTiming implements stats.Measurement

func (*Measurement) Since

func (m *Measurement) Since(start time.Time)

Since implements stats.Measurement

func (*Measurement) Values

func (m *Measurement) Values() []float64

type Metric

type Metric struct {
	Name      string
	Tags      stats.Tags
	Value     float64         // Count, Gauge
	Values    []float64       // Histogram
	Durations []time.Duration // Timer
}

Metric captures the name, tags and value(s) depending on type.

For Count and Gauge, Value is used.
For Histogram, Values is used.
For Timer, Durations is used.

type Opts

type Opts func(*Store)

func WithNow

func WithNow(nowFn func() time.Time) Opts

func WithTracing

func WithTracing() Opts

func WithTracingTimestamps

func WithTracingTimestamps() Opts

type Store

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

func New

func New(opts ...Opts) (*Store, error)

func (*Store) Get

func (ms *Store) Get(name string, tags stats.Tags) *Measurement

Get the stored measurement with the name and tags. If no measurement is found, nil is returned.

func (*Store) GetAll

func (ms *Store) GetAll() []Metric

GetAll returns the metric for all name/tags register in the store.

func (*Store) GetByName

func (ms *Store) GetByName(name string) []Metric

GetByName returns the metric for each tag variation with the given name.

func (*Store) NewSampledTaggedStat

func (ms *Store) NewSampledTaggedStat(name, statType string, tags stats.Tags) stats.Measurement

NewSampledTaggedStat implements stats.Stats

func (*Store) NewStat

func (ms *Store) NewStat(name, statType string) (m stats.Measurement)

NewStat implements stats.Stats

func (*Store) NewTaggedStat

func (ms *Store) NewTaggedStat(name, statType string, tags stats.Tags) stats.Measurement

NewTaggedStat implements stats.Stats

func (*Store) NewTracer

func (ms *Store) NewTracer(name string) stats.Tracer

func (*Store) RegisterCollector

func (s *Store) RegisterCollector(c stats.Collector) error

func (*Store) Spans

func (ms *Store) Spans() ([]tracemodel.Span, error)

func (*Store) Start

Start implements stats.Stats

func (*Store) Stop

func (*Store) Stop()

Stop implements stats.Stats

Jump to

Keyboard shortcuts

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