[MM-57066][MM-57329] Added metrics for all notification stopping points, consolidated categories between metrics and logging (#26799)

* [MM-57066] Add metric counters for notification events

* Some small changes

* Account for Metrics() sometimes being nil

* Fix test (again)

* Fix more tests

* A few changes from testing - added success counter

* Missed a mock

* Lint

* Add feature flag for notification monitoring
Этот коммит содержится в:
Devin Binnie
2024-04-18 10:30:08 -04:00
коммит произвёл GitHub
родитель 0ce5def8e2
Коммит 02e23a3275
26 изменённых файлов: 572 добавлений и 241 удалений

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

@@ -55,6 +55,8 @@ type FeatureFlags struct {
ChannelBookmarks bool
WebSocketEventScope bool
NotificationMonitoring bool
}
func (f *FeatureFlags) SetDefaults() {
@@ -77,6 +79,7 @@ func (f *FeatureFlags) SetDefaults() {
f.CloudDedicatedExportUI = false
f.ChannelBookmarks = false
f.WebSocketEventScope = false
f.NotificationMonitoring = true
}
// ToMap returns the feature flags as a map[string]string

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

@@ -3,20 +3,36 @@
package model
type NotificationStatus string
type NotificationType string
type NotificationReason string
const (
StatusBlocked = "blocked"
StatusServerError = "server_error"
StatusNotSent = "not_sent"
NotificationStatusSuccess NotificationStatus = "success"
NotificationStatusError NotificationStatus = "error"
NotificationStatusNotSent NotificationStatus = "not_sent"
TypeEmail = "email"
TypeWebsocket = "websocket"
TypePush = "push"
NotificationTypeAll NotificationType = "all"
NotificationTypeEmail NotificationType = "email"
NotificationTypeWebsocket NotificationType = "websocket"
NotificationTypePush NotificationType = "push"
ReasonServerConfig = "server_config"
ReasonUserConfig = "user_config"
ReasonUserStatus = "user_status"
ReasonFetchError = "error_fetching"
ReasonServerError = "server_error"
ReasonMissingProfile = "missing_profile"
ReasonPushProxyError = "push_proxy_error"
NotificationReasonFetchError NotificationReason = "fetch_error"
NotificationReasonParseError NotificationReason = "json_parse_error"
NotificationReasonPushProxyError NotificationReason = "push_proxy_error"
NotificationReasonPushProxySendError NotificationReason = "push_proxy_send_error"
NotificationReasonRejectedByPlugin NotificationReason = "rejected_by_plugin"
NotificationReasonSessionExpired NotificationReason = "session_expired"
NotificationReasonChannelMuted NotificationReason = "channel_muted"
NotificationReasonSystemMessage NotificationReason = "system_message"
NotificationReasonLevelSetToNone NotificationReason = "notify_level_none"
NotificationReasonNotMentioned NotificationReason = "not_mentioned"
NotificationReasonUserStatus NotificationReason = "user_status"
NotificationReasonUserIsActive NotificationReason = "user_is_active"
NotificationReasonMissingProfile NotificationReason = "missing_profile"
NotificationReasonEmailNotVerified NotificationReason = "email_not_verified"
NotificationReasonEmailSendError NotificationReason = "email_send_error"
NotificationReasonTooManyUsersInChannel NotificationReason = "too_many_users_in_channel"
NotificationReasonResolvePersistentNotificationError NotificationReason = "resolve_persistent_notification_error"
NotificationReasonMissingThreadMembership NotificationReason = "missing_thread_membership"
)