Adding webhook metrics (#5348)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
58dcf6984b
Коммит
2a9c1afd44
@@ -12,6 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
|
"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"
|
||||||
)
|
)
|
||||||
@@ -126,6 +127,10 @@ func CreateWebhookPost(userId, teamId, channelId, text, overrideUsername, overri
|
|||||||
post := &model.Post{UserId: userId, ChannelId: channelId, Message: text, Type: postType}
|
post := &model.Post{UserId: userId, ChannelId: channelId, Message: text, Type: postType}
|
||||||
post.AddProp("from_webhook", "true")
|
post.AddProp("from_webhook", "true")
|
||||||
|
|
||||||
|
if metrics := einterfaces.GetMetricsInterface(); metrics != nil {
|
||||||
|
metrics.IncrementWebhookPost()
|
||||||
|
}
|
||||||
|
|
||||||
if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
|
if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
|
||||||
if len(overrideUsername) != 0 {
|
if len(overrideUsername) != 0 {
|
||||||
post.AddProp("override_username", overrideUsername)
|
post.AddProp("override_username", overrideUsername)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ type MetricsInterface interface {
|
|||||||
StopServer()
|
StopServer()
|
||||||
|
|
||||||
IncrementPostCreate()
|
IncrementPostCreate()
|
||||||
|
IncrementWebhookPost()
|
||||||
IncrementPostSentEmail()
|
IncrementPostSentEmail()
|
||||||
IncrementPostSentPush()
|
IncrementPostSentPush()
|
||||||
IncrementPostBroadcast()
|
IncrementPostBroadcast()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user