-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathprometheus.go
59 lines (48 loc) · 1.46 KB
/
prometheus.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
58
59
package mocks
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/mock"
)
type MockObserver struct {
mock.Mock
}
func (m *MockObserver) Observe(v float64) {
m.Called(v)
}
type MockHistogram struct {
mock.Mock
}
func (m *MockHistogram) GetMetricWith(labels prometheus.Labels) (prometheus.Observer, error) {
args := m.Called(labels)
return args.Get(0).(prometheus.Observer), args.Error(1)
}
func (m *MockHistogram) GetMetricWithLabelValues(lvs ...string) (prometheus.Observer, error) {
args := m.Called(lvs)
return args.Get(0).(prometheus.Observer), args.Error(1)
}
func (m *MockHistogram) With(labels prometheus.Labels) prometheus.Observer {
args := m.Called(labels)
return args.Get(0).(prometheus.Observer)
}
func (m *MockHistogram) WithLabelValues(lvs ...string) prometheus.Observer {
new := make([]interface{}, len(lvs))
for i, v := range lvs {
new[i] = v
}
args := m.Called(new...)
return args.Get(0).(prometheus.Observer)
}
func (m *MockHistogram) CurryWith(labels prometheus.Labels) (prometheus.ObserverVec, error) {
args := m.Called(labels)
return args.Get(0).(prometheus.ObserverVec), args.Error(1)
}
func (m *MockHistogram) MustCurryWith(labels prometheus.Labels) prometheus.ObserverVec {
args := m.Called(labels)
return args.Get(0).(prometheus.ObserverVec)
}
func (m *MockHistogram) Describe(ch chan<- *prometheus.Desc) {
m.Called(ch)
}
func (m *MockHistogram) Collect(ch chan<- prometheus.Metric) {
m.Called(ch)
}