summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-01-03 09:57:38 -0500
committerenahum <nahumhbl@gmail.com>2017-01-03 11:57:38 -0300
commit96b4e0ed8767c879d5cd235b76feac43511835ed (patch)
tree1bd022385b5430bec010104bba004bc9fb9c21f2 /store
parent4bca74d5c1e425b0975a52ee06cee69c85232ced (diff)
downloadchat-96b4e0ed8767c879d5cd235b76feac43511835ed.tar.gz
chat-96b4e0ed8767c879d5cd235b76feac43511835ed.tar.bz2
chat-96b4e0ed8767c879d5cd235b76feac43511835ed.zip
Adding metrics to cache for profile by ids api (#4925)
Diffstat (limited to 'store')
-rw-r--r--store/sql_user_store.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 8db0e9624..2ce1e6eab 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -804,6 +804,7 @@ func (us SqlUserStore) GetProfileByIds(userIds []string, allowFromCache bool) St
go func() {
result := StoreResult{}
+ metrics := einterfaces.GetMetricsInterface()
var users []*model.User
userMap := make(map[string]*model.User)
@@ -820,8 +821,15 @@ func (us SqlUserStore) GetProfileByIds(userIds []string, allowFromCache bool) St
remainingUserIds = append(remainingUserIds, userId)
}
}
+ if metrics != nil {
+ metrics.AddMemCacheHitCounter("Profile By Ids", float64(len(userMap)))
+ metrics.AddMemCacheMissCounter("Profile By Ids", float64(len(remainingUserIds)))
+ }
} else {
remainingUserIds = userIds
+ if metrics != nil {
+ metrics.AddMemCacheMissCounter("Profile By Ids", float64(len(remainingUserIds)))
+ }
}
// If everything came from the cache then just return