forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring.go
48 lines (35 loc) · 894 Bytes
/
monitoring.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package monitoring
import "errors"
type Mode uint8
//go:generate stringer -type=Mode
const (
// Reported mode, is lowest report level with most basic metrics only
Reported Mode = iota
// Full reports all metrics
Full
)
// Default is the global default metrics registry provided by the monitoring package.
var Default = NewRegistry()
var errNotFound = errors.New("Name unknown")
var errInvalidName = errors.New("Name does not point to a valid variable")
func VisitMode(mode Mode, vs Visitor) {
Default.Visit(mode, vs)
}
func Visit(vs Visitor) {
Default.Visit(Full, vs)
}
func Do(mode Mode, f func(string, interface{})) {
Default.Do(mode, f)
}
func Get(name string) Var {
return Default.Get(name)
}
func GetRegistry(name string) *Registry {
return Default.GetRegistry(name)
}
func Remove(name string) {
Default.Remove(name)
}
func Clear() error {
return Default.Clear()
}