From 3b08d6b8e49f4ebc2d7c8fde46029de53db0262b Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 13 Jul 2022 18:30:03 -0400 Subject: [PATCH] fix stats name --- internal/worker/notifications.go | 2 +- internal/worker/stuck_notifications.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/worker/notifications.go b/internal/worker/notifications.go index cf56b59..7a49404 100644 --- a/internal/worker/notifications.go +++ b/internal/worker/notifications.go @@ -138,7 +138,7 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) { now := time.Now() defer func() { elapsed := time.Now().Sub(now).Milliseconds() - _ = nc.statsd.Histogram("apollo.queue.runtime", float64(elapsed), []string{"queue:notifications"}, 0.1) + _ = nc.statsd.Histogram("apollo.consumer.runtime", float64(elapsed), []string{"queue:notifications"}, 0.1) }() id := delivery.Payload() diff --git a/internal/worker/stuck_notifications.go b/internal/worker/stuck_notifications.go index 147c690..bab076d 100644 --- a/internal/worker/stuck_notifications.go +++ b/internal/worker/stuck_notifications.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "strconv" + "time" "github.com/DataDog/datadog-go/statsd" "github.com/adjust/rmq/v4" @@ -100,6 +101,12 @@ func NewStuckNotificationsConsumer(snw *stuckNotificationsWorker, tag int) *stuc } func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) { + now := time.Now() + defer func() { + elapsed := time.Now().Sub(now).Milliseconds() + _ = snc.statsd.Histogram("apollo.consumer.runtime", float64(elapsed), []string{"queue:stuck-notifications"}, 0.1) + }() + id, err := strconv.ParseInt(delivery.Payload(), 10, 64) if err != nil { snc.logger.Error("failed to parse account id from payload", zap.Error(err), zap.String("payload", delivery.Payload()))