diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-12-19 10:16:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 10:16:22 -0500 |
commit | f96173528f08684092b89f903f0389fe2b607192 (patch) | |
tree | f34f9057417ad6758cd65dc246bc764530f2134c /api/status.go | |
parent | 6a5cdd5cdf09317ce259dd146fc4f1cb76d8b9b6 (diff) | |
download | chat-f96173528f08684092b89f903f0389fe2b607192.tar.gz chat-f96173528f08684092b89f903f0389fe2b607192.tar.bz2 chat-f96173528f08684092b89f903f0389fe2b607192.zip |
Adding metrics for caching mechanisms (#4828)
Diffstat (limited to 'api/status.go')
-rw-r--r-- | api/status.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/api/status.go b/api/status.go index a3d419862..a0ad4cd76 100644 --- a/api/status.go +++ b/api/status.go @@ -111,13 +111,20 @@ func getStatusesByIdsWebSocket(req *model.WebSocketRequest) (map[string]interfac func GetStatusesByIds(userIds []string) (map[string]interface{}, *model.AppError) { statusMap := map[string]interface{}{} + metrics := einterfaces.GetMetricsInterface() missingUserIds := []string{} for _, userId := range userIds { if result, ok := statusCache.Get(userId); ok { statusMap[userId] = result.(*model.Status).Status + if metrics != nil { + metrics.IncrementMemCacheHitCounter("Status") + } } else { missingUserIds = append(missingUserIds, userId) + if metrics != nil { + metrics.IncrementMemCacheMissCounter("Status") + } } } |