@@ -177,7 +177,7 @@ type LifoBlockingLimiter struct {
177
177
maxBacklogSize uint64
178
178
maxBacklogTimeout time.Duration
179
179
180
- backlog lifoQueue
180
+ backlog * lifoQueue
181
181
mu sync.RWMutex
182
182
}
183
183
@@ -203,16 +203,14 @@ func NewLifoBlockingLimiter(
203
203
delegate : delegate ,
204
204
maxBacklogSize : uint64 (maxBacklogSize ),
205
205
maxBacklogTimeout : maxBacklogTimeout ,
206
- backlog : lifoQueue {},
206
+ backlog : & lifoQueue {},
207
207
}
208
208
209
- registry .RegisterGauge (core .MetricLifoQueueLimit , func () ( value float64 , ok bool ) {
210
- return float64 ( maxBacklogSize ), true
211
- }, tags ... )
209
+ registry .RegisterGauge (core .MetricLifoQueueLimit , core . NewIntMetricSupplierWrapper ( func () int {
210
+ return maxBacklogSize
211
+ }) , tags ... )
212
212
213
- registry .RegisterGauge (core .MetricLifoQueueSize , func () (value float64 , ok bool ) {
214
- return float64 (l .backlog .len ()), true
215
- }, tags ... )
213
+ registry .RegisterGauge (core .MetricLifoQueueSize , core .NewUint64MetricSupplierWrapper (l .backlog .len ), tags ... )
216
214
217
215
return l
218
216
}
@@ -261,7 +259,7 @@ func (l *LifoBlockingLimiter) tryAcquire(ctx context.Context) core.Listener {
261
259
// If acquired the caller must call one of the Listener methods when the operation has been completed to release
262
260
// the count.
263
261
//
264
- // context Context for the request. The context is used by advanced strategies such as LookupPartitionStrategy.
262
+ // ctx Context for the request. The context is used by advanced strategies such as LookupPartitionStrategy.
265
263
func (l * LifoBlockingLimiter ) Acquire (ctx context.Context ) (core.Listener , bool ) {
266
264
delegateListener := l .tryAcquire (ctx )
267
265
if delegateListener == nil {
0 commit comments