mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Adding webhook metrics (#5348)
This commit is contained in:
committed by
Corey Hulen
parent
58dcf6984b
commit
2a9c1afd44
@@ -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)
|
||||
|
||||
@@ -8,6 +8,7 @@ type MetricsInterface interface {
|
||||
StopServer()
|
||||
|
||||
IncrementPostCreate()
|
||||
IncrementWebhookPost()
|
||||
IncrementPostSentEmail()
|
||||
IncrementPostSentPush()
|
||||
IncrementPostBroadcast()
|
||||
|
||||
Reference in New Issue
Block a user