Example of how to call metrics (#5621)
Этот коммит содержится в:
@@ -4,10 +4,10 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"github.com/mattermost/platform/einterfaces"
|
"github.com/mattermost/platform/einterfaces"
|
||||||
"github.com/mattermost/platform/model"
|
"github.com/mattermost/platform/model"
|
||||||
"github.com/mattermost/platform/utils"
|
"github.com/mattermost/platform/utils"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
)
|
)
|
||||||
@@ -33,11 +33,11 @@ func GetSession(token string) (*model.Session, *model.AppError) {
|
|||||||
if ts, ok := sessionCache.Get(token); ok {
|
if ts, ok := sessionCache.Get(token); ok {
|
||||||
session = ts.(*model.Session)
|
session = ts.(*model.Session)
|
||||||
if metrics != nil {
|
if metrics != nil {
|
||||||
metrics.IncrementMemCacheHitCounter("Session")
|
metrics.IncrementMemCacheHitCounterSession()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if metrics != nil {
|
if metrics != nil {
|
||||||
metrics.IncrementMemCacheMissCounter("Session")
|
metrics.IncrementMemCacheMissCounterSession()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ type MetricsInterface interface {
|
|||||||
|
|
||||||
IncrementMemCacheHitCounter(cacheName string)
|
IncrementMemCacheHitCounter(cacheName string)
|
||||||
IncrementMemCacheMissCounter(cacheName string)
|
IncrementMemCacheMissCounter(cacheName string)
|
||||||
|
IncrementMemCacheMissCounterSession()
|
||||||
|
IncrementMemCacheHitCounterSession()
|
||||||
|
|
||||||
IncrementWebsocketEvent(eventType string)
|
IncrementWebsocketEvent(eventType string)
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user