Adding webhook metrics (#5348)

This commit is contained in:
Christopher Speller
2017-02-10 10:05:12 -05:00
committed by Corey Hulen
parent 58dcf6984b
commit 2a9c1afd44
2 changed files with 6 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import (
"strings"
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
"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.AddProp("from_webhook", "true")
if metrics := einterfaces.GetMetricsInterface(); metrics != nil {
metrics.IncrementWebhookPost()
}
if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
if len(overrideUsername) != 0 {
post.AddProp("override_username", overrideUsername)

View File

@@ -8,6 +8,7 @@ type MetricsInterface interface {
StopServer()
IncrementPostCreate()
IncrementWebhookPost()
IncrementPostSentEmail()
IncrementPostSentPush()
IncrementPostBroadcast()