-
Notifications
You must be signed in to change notification settings - Fork 12
/
null_registrar.go
57 lines (41 loc) · 1.02 KB
/
null_registrar.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
49
50
51
52
53
54
55
56
57
package debug
import (
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
)
type NullRegistrar struct {
}
func (*NullRegistrar) Registerer() prometheus.Registerer {
return &NullRegisterer{}
}
func (*NullRegistrar) Gatherer() prometheus.Gatherer {
return &NullGatherer{}
}
func (*NullRegistrar) Set(string, float64, ...string) {
}
func (*NullRegistrar) Inc(string, ...string) {
}
func (*NullRegistrar) Add(string, float64, ...string) {
}
func (*NullRegistrar) Histogram(string) prometheus.Observer {
return &NullObserver{}
}
type NullObserver struct {
}
func (o *NullObserver) Observe(float64) {
}
type NullRegisterer struct {
}
func (n *NullRegisterer) Register(prometheus.Collector) error {
return nil
}
func (n *NullRegisterer) MustRegister(...prometheus.Collector) {
}
func (n *NullRegisterer) Unregister(prometheus.Collector) bool {
return true
}
type NullGatherer struct {
}
func (n *NullGatherer) Gather() ([]*dto.MetricFamily, error) {
return []*dto.MetricFamily{}, nil
}