summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-12-19 10:16:22 -0500
committerGitHub <noreply@github.com>2016-12-19 10:16:22 -0500
commitf96173528f08684092b89f903f0389fe2b607192 (patch)
treef34f9057417ad6758cd65dc246bc764530f2134c /api/context.go
parent6a5cdd5cdf09317ce259dd146fc4f1cb76d8b9b6 (diff)
downloadchat-f96173528f08684092b89f903f0389fe2b607192.tar.gz
chat-f96173528f08684092b89f903f0389fe2b607192.tar.bz2
chat-f96173528f08684092b89f903f0389fe2b607192.zip
Adding metrics for caching mechanisms (#4828)
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go
index 07b6f5005..4042a7b0f 100644
--- a/api/context.go
+++ b/api/context.go
@@ -508,9 +508,18 @@ func Handle404(w http.ResponseWriter, r *http.Request) {
}
func GetSession(token string) *model.Session {
+ metrics := einterfaces.GetMetricsInterface()
+
var session *model.Session
if ts, ok := sessionCache.Get(token); ok {
session = ts.(*model.Session)
+ if metrics != nil {
+ metrics.IncrementMemCacheHitCounter("Session")
+ }
+ } else {
+ if metrics != nil {
+ metrics.IncrementMemCacheMissCounter("Session")
+ }
}
if session == nil {