Documentation ¶
Index ¶
- Variables
- func Clear() error
- func Do(mode Mode, f func(string, interface{}))
- func DoExpvars(f func(string, interface{}))
- func IgnorePublishExpvar(o options) options
- func PublishExpvar(o options) options
- func Remove(name string)
- func Report(o options) options
- func ReportBool(V Visitor, name string, value bool)
- func ReportFloat(V Visitor, name string, value float64)
- func ReportInt(V Visitor, name string, value int64)
- func ReportString(V Visitor, name string, value string)
- func Visit(vs Visitor)
- func VisitExpvars(vs Visitor)
- func VisitMode(mode Mode, vs Visitor)
- type FlatSnapshot
- type Float
- type Int
- type KeyValueVisitor
- func (vs *KeyValueVisitor) OnBool(b bool)
- func (vs *KeyValueVisitor) OnFloat(f float64)
- func (vs *KeyValueVisitor) OnInt(i int64)
- func (vs *KeyValueVisitor) OnKey(name string)
- func (vs *KeyValueVisitor) OnNil()
- func (vs *KeyValueVisitor) OnRegistryFinished()
- func (vs *KeyValueVisitor) OnRegistryStart()
- func (vs *KeyValueVisitor) OnString(s string)
- type Mode
- type Option
- type Registry
- func (r *Registry) Add(name string, v Var, m Mode)
- func (r *Registry) Clear() error
- func (r *Registry) Do(mode Mode, f func(string, interface{}))
- func (r *Registry) Get(name string) Var
- func (r *Registry) GetRegistry(name string) *Registry
- func (r *Registry) NewRegistry(name string, opts ...Option) *Registry
- func (r *Registry) Remove(name string)
- func (r *Registry) Visit(mode Mode, vs Visitor)
- type RegistryVisitor
- type String
- type ValueVisitor
- type Var
- type Visitor
Constants ¶
This section is empty.
Variables ¶
var Default = NewRegistry()
Default is the global default metrics registry provided by the monitoring package.
Functions ¶
func IgnorePublishExpvar ¶
func IgnorePublishExpvar(o options) options
IgnorePublishExpvar disables publishing expvar variables in a sub-registry.
func PublishExpvar ¶
func PublishExpvar(o options) options
PublishExpvar enables publishing all registered variables via expvar interface. Note: expvar does not allow removal of any stats.
func ReportBool ¶
func ReportFloat ¶
func ReportString ¶
func VisitExpvars ¶
func VisitExpvars(vs Visitor)
VisitExpvars iterates all expvar metrics using the Visitor interface. The top-level metrics "memstats" and "cmdline", plus all monitoring.X metric types are ignored.
Types ¶
type FlatSnapshot ¶
type FlatSnapshot struct { Bools map[string]bool Ints map[string]int64 Floats map[string]float64 Strings map[string]string }
FlatSnapshot represents a flatten snapshot of all metrics. Names in the tree will be joined with `.` .
func CollectFlatSnapshot ¶
func CollectFlatSnapshot(r *Registry, mode Mode, expvar bool) FlatSnapshot
CollectFlatSnapshot collects a flattened snapshot of a metrics tree start with the given registry.
func MakeFlatSnapshot ¶
func MakeFlatSnapshot() FlatSnapshot
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is a 64 bit float variable satisfying the Var interface.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is a 64 bit integer variable satisfying the Var interface.
type KeyValueVisitor ¶
type KeyValueVisitor struct {
// contains filtered or unexported fields
}
func NewKeyValueVisitor ¶
func NewKeyValueVisitor(cb func(string, interface{})) *KeyValueVisitor
func (*KeyValueVisitor) OnBool ¶
func (vs *KeyValueVisitor) OnBool(b bool)
func (*KeyValueVisitor) OnFloat ¶
func (vs *KeyValueVisitor) OnFloat(f float64)
func (*KeyValueVisitor) OnInt ¶
func (vs *KeyValueVisitor) OnInt(i int64)
func (*KeyValueVisitor) OnKey ¶
func (vs *KeyValueVisitor) OnKey(name string)
func (*KeyValueVisitor) OnNil ¶
func (vs *KeyValueVisitor) OnNil()
func (*KeyValueVisitor) OnRegistryFinished ¶
func (vs *KeyValueVisitor) OnRegistryFinished()
func (*KeyValueVisitor) OnRegistryStart ¶
func (vs *KeyValueVisitor) OnRegistryStart()
func (*KeyValueVisitor) OnString ¶
func (vs *KeyValueVisitor) OnString(s string)
type Option ¶
type Option func(options) options
Option type for passing additional options to NewRegistry.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry to store variables and sub-registries. When adding or retrieving variables, all names are split on the `.`-symbol and intermediate registries will be generated.
func GetRegistry ¶
func NewRegistry ¶
NewRegistry create a new empty unregistered registry
func (*Registry) Add ¶
Add adds a new variable to the registry. The method panics if the variables name is already in use.
func (*Registry) GetRegistry ¶
GetRegistry tries to find a sub-registry by name.
func (*Registry) NewRegistry ¶
NewRegistry creates and register a new registry
type RegistryVisitor ¶
type RegistryVisitor interface { OnRegistryStart() OnRegistryFinished() OnKey(s string) }
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string variable satisfying the Var interface.
type ValueVisitor ¶
type Visitor ¶
type Visitor interface { ValueVisitor RegistryVisitor }
Visitor interface supports traversing a monitoring registry