Example of how to call metrics (#5621)

Этот коммит содержится в:
Corey Hulen
2017-03-06 10:15:37 -05:00
коммит произвёл GitHub
родитель ca6f364d70
Коммит 847c716ea2
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@@ -4,10 +4,10 @@
package app
import (
"net/http"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
"net/http"
l4g "github.com/alecthomas/log4go"
)
@@ -33,11 +33,11 @@ func GetSession(token string) (*model.Session, *model.AppError) {
if ts, ok := sessionCache.Get(token); ok {
session = ts.(*model.Session)
if metrics != nil {
metrics.IncrementMemCacheHitCounter("Session")
metrics.IncrementMemCacheHitCounterSession()
}
} else {
if metrics != nil {
metrics.IncrementMemCacheMissCounter("Session")
metrics.IncrementMemCacheMissCounterSession()
}
}

Просмотреть файл

@@ -29,6 +29,8 @@ type MetricsInterface interface {
IncrementMemCacheHitCounter(cacheName string)
IncrementMemCacheMissCounter(cacheName string)
IncrementMemCacheMissCounterSession()
IncrementMemCacheHitCounterSession()
IncrementWebsocketEvent(eventType string)