metrics for queues
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m45s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m45s
This commit is contained in:
@@ -172,6 +172,10 @@ var (
|
||||
Name: "cart_remote_lookup_total",
|
||||
Help: "The total number of remote lookups",
|
||||
})
|
||||
packetQueue = promauto.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "cart_packet_queue_size",
|
||||
Help: "The total number of packets in the queue",
|
||||
})
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -211,6 +215,7 @@ func NewPacketQueue(connection net.Conn) *PacketQueue {
|
||||
|
||||
//return
|
||||
}
|
||||
packetQueue.Inc()
|
||||
queue.mu.Lock()
|
||||
queue.Packets = append(queue.Packets, PacketWithData{
|
||||
MessageType: messageType,
|
||||
@@ -226,7 +231,9 @@ func NewPacketQueue(connection net.Conn) *PacketQueue {
|
||||
queue.mu.Lock()
|
||||
for i, packet := range queue.Packets {
|
||||
if time.Since(packet.Added) < time.Second*3 {
|
||||
|
||||
queue.Packets = queue.Packets[i:]
|
||||
packetQueue.Set(float64(len(queue.Packets)))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user