mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-24 12:47:43 +00:00
better latency measurements
This commit is contained in:
parent
f785d1a3a4
commit
131205a0cb
1 changed files with 5 additions and 7 deletions
|
@ -214,13 +214,6 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
rac = nc.reddit.NewAuthenticatedClient(account.AccountID, tokens.RefreshToken, tokens.AccessToken)
|
||||
}
|
||||
|
||||
// Only update delay on accounts we can actually check, otherwise it skews
|
||||
// the numbers too much.
|
||||
if !newAccount {
|
||||
latency := now.Sub(previousNextCheck)
|
||||
_ = nc.statsd.Histogram("apollo.queue.delay", float64(latency.Milliseconds()), []string{}, rate)
|
||||
}
|
||||
|
||||
nc.logger.Debug("fetching message inbox", zap.String("account#reddit_account_id", id), zap.String("account#username", account.NormalizedUsername()))
|
||||
|
||||
opts := []reddit.RequestOption{reddit.WithQuery("limit", "10")}
|
||||
|
@ -313,6 +306,11 @@ func (nc *notificationsConsumer) Consume(delivery rmq.Delivery) {
|
|||
continue
|
||||
}
|
||||
|
||||
// Latency is the time difference between the appearence of the new message and the
|
||||
// time we notified at.
|
||||
latency := now.Sub(msg.CreatedAt)
|
||||
_ = nc.statsd.Histogram("apollo.queue.delay", float64(latency.Milliseconds()), []string{}, rate)
|
||||
|
||||
notification := &apns2.Notification{}
|
||||
notification.Topic = "com.christianselig.Apollo"
|
||||
notification.Payload = payloadFromMessage(account, msg, msgs.Count)
|
||||
|
|
Loading…
Reference in a new issue