Documentation ¶
Index ¶
- Constants
- Variables
- func Clear() error
- func CollectStructSnapshot(r *Registry, mode Mode, expvar bool) map[string]interface{}
- func Do(mode Mode, f func(string, interface{}))
- func DoExpvars(f func(string, interface{}))
- func DoNotReport(o options) options
- func GetClusterUUID(monitoringCfg *config.C) (string, error)
- func IgnorePublishExpvar(o options) options
- func IsBufferEnabled(monitoringCfg *config.C) bool
- func IsEnabled(monitoringCfg *config.C) bool
- func OverrideWithCloudSettings(monitoringCfg *config.C) error
- 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 ReportNamespace(V Visitor, name string, f func())
- func ReportString(V Visitor, name string, value string)
- func ReportStringSlice(V Visitor, name string, value []string)
- func ReportVar(V Visitor, name string, m Mode, v Var)
- func Visit(vs Visitor)
- func VisitExpvars(vs Visitor)
- func VisitMode(mode Mode, vs Visitor)
- type BeatConfig
- type Bool
- type FlatSnapshot
- type Float
- type Func
- type FuncVar
- 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)
- func (vs *KeyValueVisitor) OnStringSlice(f []string)
- type Mode
- type Namespace
- type Namespaces
- 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 Timestamp
- type Uint
- type UniqueList
- type ValueVisitor
- type Var
- type Visitor
Constants ¶
const TSLayout = "2006-01-02T15:04:05.000Z"
TsLayout is the layout to be used in the timestamp marshaling/unmarshaling.
Variables ¶
var Default = NewRegistry()
Default is the global default metrics registry provided by the monitoring package.
Functions ¶
func CollectStructSnapshot ¶
CollectStructSnapshot collects a structured metrics snaphot of a metrics tree starting with the given registry. Empty namespaces will be omitted.
func DoNotReport ¶
func DoNotReport(o options) options
func GetClusterUUID ¶
GetClusterUUID returns the value of the monitoring.cluster_uuid setting, if it is set.
func IgnorePublishExpvar ¶
func IgnorePublishExpvar(o options) options
IgnorePublishExpvar disables publishing expvar variables in a sub-registry.
func IsBufferEnabled ¶
IsBufferEnabled will check if the monitoring buffer is explicitly enabled.
func OverrideWithCloudSettings ¶
OverrideWithCloudSettings overrides monitoring.elasticsearch.* with monitoring.cloud.* if the latter are set.
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 ¶
ReportBool reports a bool for the visitor
func ReportFloat ¶
ReportFloat reports a float type for the visitor
func ReportNamespace ¶
ReportNamespace reports a value for a given namespace
func ReportString ¶
ReportString reports a string value for the visitor
func ReportStringSlice ¶
ReportStringSlice reports a string array for the visitor
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 BeatConfig ¶
BeatConfig represents the part of the $BEAT.yml to do with monitoring settings
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a Bool variable satisfying the Var interface.
type FlatSnapshot ¶
type FlatSnapshot struct { Bools map[string]bool Ints map[string]int64 Floats map[string]float64 Strings map[string]string StringSlices 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)
func (*KeyValueVisitor) OnStringSlice ¶
func (vs *KeyValueVisitor) OnStringSlice(f []string)
type Namespace ¶
Namespace contains the name of the namespace and it's registry
func GetNamespace ¶
GetNamespace gets the namespace with the given name. If the namespace does not exist yet, a new one is created.
func (*Namespace) GetRegistry ¶
GetRegistry gets the registry of the namespace
func (*Namespace) SetRegistry ¶
SetRegistry sets the registry of the namespace
type Namespaces ¶
Namespaces is a list of Namespace structs
func (*Namespaces) Get ¶
func (n *Namespaces) Get(key string) *Namespace
Get returns the namespace for the given key. If the key does not exist, new namespace is created.
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) }
RegistryVisitor is the interface type for interacting with a monitoring registry
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a string variable satisfying the Var interface.
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp is a timestamp variable satisfying the Var interface.
func NewTimestamp ¶
NewTimestamp creates and registers a new timestamp variable.
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
Uint is a 64bit unsigned integer variable satisfying the Var interface.
type UniqueList ¶
UniqueList is used to collect a list of items (strings) and get the total count and all unique strings.
func (*UniqueList) Add ¶
func (l *UniqueList) Add(item string)
Add adds an item to the list and increases the count for it.
func (*UniqueList) Remove ¶
func (l *UniqueList) Remove(item string)
Remove removes and item for the list and decreases the count.
func (*UniqueList) Report ¶
func (l *UniqueList) Report(m Mode, V Visitor)
Report can be used as reporting function for monitoring. It reports a total count value and a names array with all the items.
type ValueVisitor ¶
type ValueVisitor interface { OnString(s string) OnBool(b bool) OnInt(i int64) OnFloat(f float64) OnStringSlice(f []string) }
ValueVisitor is an interface for the monitoring visitor type
type Visitor ¶
type Visitor interface { ValueVisitor RegistryVisitor }
Visitor interface supports traversing a monitoring registry