fix stats name

This commit is contained in:
Andre Medeiros 2022-07-13 18:30:03 -04:00
parent 73da53ab70
commit 3b08d6b8e4
2 changed files with 8 additions and 1 deletions

View file

@ -138,7 +138,7 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
now := time.Now() now := time.Now()
defer func() { defer func() {
elapsed := time.Now().Sub(now).Milliseconds() 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() id := delivery.Payload()

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"os" "os"
"strconv" "strconv"
"time"
"github.com/DataDog/datadog-go/statsd" "github.com/DataDog/datadog-go/statsd"
"github.com/adjust/rmq/v4" "github.com/adjust/rmq/v4"
@ -100,6 +101,12 @@ func NewStuckNotificationsConsumer(snw *stuckNotificationsWorker, tag int) *stuc
} }
func (snc *stuckNotificationsConsumer) Consume(delivery rmq.Delivery) { 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) id, err := strconv.ParseInt(delivery.Payload(), 10, 64)
if err != nil { if err != nil {
snc.logger.Error("failed to parse account id from payload", zap.Error(err), zap.String("payload", delivery.Payload())) snc.logger.Error("failed to parse account id from payload", zap.Error(err), zap.String("payload", delivery.Payload()))