forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics_provider.go
254 lines (231 loc) · 7.26 KB
/
metrics_provider.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
sync "sync"
metrics "github.com/hyperledger/fabric/common/metrics"
)
type MetricsProvider struct {
NewCounterStub func(metrics.CounterOpts) metrics.Counter
newCounterMutex sync.RWMutex
newCounterArgsForCall []struct {
arg1 metrics.CounterOpts
}
newCounterReturns struct {
result1 metrics.Counter
}
newCounterReturnsOnCall map[int]struct {
result1 metrics.Counter
}
NewGaugeStub func(metrics.GaugeOpts) metrics.Gauge
newGaugeMutex sync.RWMutex
newGaugeArgsForCall []struct {
arg1 metrics.GaugeOpts
}
newGaugeReturns struct {
result1 metrics.Gauge
}
newGaugeReturnsOnCall map[int]struct {
result1 metrics.Gauge
}
NewHistogramStub func(metrics.HistogramOpts) metrics.Histogram
newHistogramMutex sync.RWMutex
newHistogramArgsForCall []struct {
arg1 metrics.HistogramOpts
}
newHistogramReturns struct {
result1 metrics.Histogram
}
newHistogramReturnsOnCall map[int]struct {
result1 metrics.Histogram
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *MetricsProvider) NewCounter(arg1 metrics.CounterOpts) metrics.Counter {
fake.newCounterMutex.Lock()
ret, specificReturn := fake.newCounterReturnsOnCall[len(fake.newCounterArgsForCall)]
fake.newCounterArgsForCall = append(fake.newCounterArgsForCall, struct {
arg1 metrics.CounterOpts
}{arg1})
fake.recordInvocation("NewCounter", []interface{}{arg1})
fake.newCounterMutex.Unlock()
if fake.NewCounterStub != nil {
return fake.NewCounterStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.newCounterReturns
return fakeReturns.result1
}
func (fake *MetricsProvider) NewCounterCallCount() int {
fake.newCounterMutex.RLock()
defer fake.newCounterMutex.RUnlock()
return len(fake.newCounterArgsForCall)
}
func (fake *MetricsProvider) NewCounterCalls(stub func(metrics.CounterOpts) metrics.Counter) {
fake.newCounterMutex.Lock()
defer fake.newCounterMutex.Unlock()
fake.NewCounterStub = stub
}
func (fake *MetricsProvider) NewCounterArgsForCall(i int) metrics.CounterOpts {
fake.newCounterMutex.RLock()
defer fake.newCounterMutex.RUnlock()
argsForCall := fake.newCounterArgsForCall[i]
return argsForCall.arg1
}
func (fake *MetricsProvider) NewCounterReturns(result1 metrics.Counter) {
fake.newCounterMutex.Lock()
defer fake.newCounterMutex.Unlock()
fake.NewCounterStub = nil
fake.newCounterReturns = struct {
result1 metrics.Counter
}{result1}
}
func (fake *MetricsProvider) NewCounterReturnsOnCall(i int, result1 metrics.Counter) {
fake.newCounterMutex.Lock()
defer fake.newCounterMutex.Unlock()
fake.NewCounterStub = nil
if fake.newCounterReturnsOnCall == nil {
fake.newCounterReturnsOnCall = make(map[int]struct {
result1 metrics.Counter
})
}
fake.newCounterReturnsOnCall[i] = struct {
result1 metrics.Counter
}{result1}
}
func (fake *MetricsProvider) NewGauge(arg1 metrics.GaugeOpts) metrics.Gauge {
fake.newGaugeMutex.Lock()
ret, specificReturn := fake.newGaugeReturnsOnCall[len(fake.newGaugeArgsForCall)]
fake.newGaugeArgsForCall = append(fake.newGaugeArgsForCall, struct {
arg1 metrics.GaugeOpts
}{arg1})
fake.recordInvocation("NewGauge", []interface{}{arg1})
fake.newGaugeMutex.Unlock()
if fake.NewGaugeStub != nil {
return fake.NewGaugeStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.newGaugeReturns
return fakeReturns.result1
}
func (fake *MetricsProvider) NewGaugeCallCount() int {
fake.newGaugeMutex.RLock()
defer fake.newGaugeMutex.RUnlock()
return len(fake.newGaugeArgsForCall)
}
func (fake *MetricsProvider) NewGaugeCalls(stub func(metrics.GaugeOpts) metrics.Gauge) {
fake.newGaugeMutex.Lock()
defer fake.newGaugeMutex.Unlock()
fake.NewGaugeStub = stub
}
func (fake *MetricsProvider) NewGaugeArgsForCall(i int) metrics.GaugeOpts {
fake.newGaugeMutex.RLock()
defer fake.newGaugeMutex.RUnlock()
argsForCall := fake.newGaugeArgsForCall[i]
return argsForCall.arg1
}
func (fake *MetricsProvider) NewGaugeReturns(result1 metrics.Gauge) {
fake.newGaugeMutex.Lock()
defer fake.newGaugeMutex.Unlock()
fake.NewGaugeStub = nil
fake.newGaugeReturns = struct {
result1 metrics.Gauge
}{result1}
}
func (fake *MetricsProvider) NewGaugeReturnsOnCall(i int, result1 metrics.Gauge) {
fake.newGaugeMutex.Lock()
defer fake.newGaugeMutex.Unlock()
fake.NewGaugeStub = nil
if fake.newGaugeReturnsOnCall == nil {
fake.newGaugeReturnsOnCall = make(map[int]struct {
result1 metrics.Gauge
})
}
fake.newGaugeReturnsOnCall[i] = struct {
result1 metrics.Gauge
}{result1}
}
func (fake *MetricsProvider) NewHistogram(arg1 metrics.HistogramOpts) metrics.Histogram {
fake.newHistogramMutex.Lock()
ret, specificReturn := fake.newHistogramReturnsOnCall[len(fake.newHistogramArgsForCall)]
fake.newHistogramArgsForCall = append(fake.newHistogramArgsForCall, struct {
arg1 metrics.HistogramOpts
}{arg1})
fake.recordInvocation("NewHistogram", []interface{}{arg1})
fake.newHistogramMutex.Unlock()
if fake.NewHistogramStub != nil {
return fake.NewHistogramStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.newHistogramReturns
return fakeReturns.result1
}
func (fake *MetricsProvider) NewHistogramCallCount() int {
fake.newHistogramMutex.RLock()
defer fake.newHistogramMutex.RUnlock()
return len(fake.newHistogramArgsForCall)
}
func (fake *MetricsProvider) NewHistogramCalls(stub func(metrics.HistogramOpts) metrics.Histogram) {
fake.newHistogramMutex.Lock()
defer fake.newHistogramMutex.Unlock()
fake.NewHistogramStub = stub
}
func (fake *MetricsProvider) NewHistogramArgsForCall(i int) metrics.HistogramOpts {
fake.newHistogramMutex.RLock()
defer fake.newHistogramMutex.RUnlock()
argsForCall := fake.newHistogramArgsForCall[i]
return argsForCall.arg1
}
func (fake *MetricsProvider) NewHistogramReturns(result1 metrics.Histogram) {
fake.newHistogramMutex.Lock()
defer fake.newHistogramMutex.Unlock()
fake.NewHistogramStub = nil
fake.newHistogramReturns = struct {
result1 metrics.Histogram
}{result1}
}
func (fake *MetricsProvider) NewHistogramReturnsOnCall(i int, result1 metrics.Histogram) {
fake.newHistogramMutex.Lock()
defer fake.newHistogramMutex.Unlock()
fake.NewHistogramStub = nil
if fake.newHistogramReturnsOnCall == nil {
fake.newHistogramReturnsOnCall = make(map[int]struct {
result1 metrics.Histogram
})
}
fake.newHistogramReturnsOnCall[i] = struct {
result1 metrics.Histogram
}{result1}
}
func (fake *MetricsProvider) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.newCounterMutex.RLock()
defer fake.newCounterMutex.RUnlock()
fake.newGaugeMutex.RLock()
defer fake.newGaugeMutex.RUnlock()
fake.newHistogramMutex.RLock()
defer fake.newHistogramMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *MetricsProvider) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}