mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 21:27:42 +00:00
measure message age
This commit is contained in:
parent
556c1dd9b2
commit
da20e76d1b
1 changed files with 3 additions and 2 deletions
|
@ -139,8 +139,9 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
||||||
key := fmt.Sprintf("locks:accounts:%s", id)
|
key := fmt.Sprintf("locks:accounts:%s", id)
|
||||||
|
|
||||||
// Measure queue latency
|
// Measure queue latency
|
||||||
ttl := nc.redis.TTL(nc, key).Val().Milliseconds()
|
ttl := nc.redis.TTL(nc, key).Val()
|
||||||
_ = nc.statsd.Histogram("apollo.dequeue.time", float64(ttl), []string{"queue:notifications"}, 1.0)
|
age := (domain.NotificationCheckTimeout - ttl)
|
||||||
|
_ = nc.statsd.Histogram("apollo.dequeue.latency", float64(age.Milliseconds()), []string{"queue:notifications"}, 1.0)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := nc.redis.Del(nc, key).Err(); err != nil {
|
if err := nc.redis.Del(nc, key).Err(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue