Documentation
¶
Overview ¶
Package stats tracks staticics for the gomodfs file system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveSpan ¶
type ActiveSpan struct {
// contains filtered or unexported fields
}
func (*ActiveSpan) End ¶
func (s *ActiveSpan) End(err error)
type OpStat ¶
type OpStat struct {
Started int
Ended int
Errs int // all errors
CtxErrs int // subset of Errs where the ctx is done
TotalDur time.Duration
}
OpStat holds statistics for a single operation type.
All fields are guarded by the Stats.mu mutex.
func (*OpStat) NumSuccess ¶
NumSuccess returns the number of successful operations.
type Stats ¶
type Stats struct {
MetricOpStarted *prometheus.CounterVec // used if non-nil
MetricOpEnded *prometheus.CounterVec // used if non-nil
MetricOpDuration *prometheus.CounterVec // used if non-nil
// contains filtered or unexported fields
}
Stats holds the operation statistics for the gomodfs file system.
If nil, no statistics are collected.
func NewStatsWithRegistry ¶
func NewStatsWithRegistry(reg *prometheus.Registry) *Stats
NewStatsWithRegstry returns a new Stats instance with metrics initialized and registered to the provided registry.
func (*Stats) Clone ¶
Clone returns a clone of the current operation statistics, keyed by operation name.
If st is nil, it returns nil. Otherwise it returns a non-nil map.
func (*Stats) StartSpan ¶
func (st *Stats) StartSpan(op string) *ActiveSpan
StartSpan starts a new operation span for the given op.
If s is nil, a non-nil ActiveSpan is returned that does nothing when its End method is called.