[MM-58159] Add admin setting for notification monitoring alongside feature flag (#26979)
* [MM-58159] Add admin setting for notification monitoring alongside feature flag * Use helper function
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f111db5fe8
Коммит
d6a8ad0d55
@@ -1736,11 +1736,7 @@ func ShouldAckWebsocketNotification(channelType model.ChannelType, userNotificat
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) CountNotification(notificationType model.NotificationType) {
|
func (a *App) CountNotification(notificationType model.NotificationType) {
|
||||||
if a.Metrics() == nil {
|
if a.notificationMetricsDisabled() {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !a.Config().FeatureFlags.NotificationMonitoring {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1748,11 +1744,7 @@ func (a *App) CountNotification(notificationType model.NotificationType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) CountNotificationAck(notificationType model.NotificationType) {
|
func (a *App) CountNotificationAck(notificationType model.NotificationType) {
|
||||||
if a.Metrics() == nil {
|
if a.notificationMetricsDisabled() {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !a.Config().FeatureFlags.NotificationMonitoring {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1764,11 +1756,7 @@ func (a *App) CountNotificationReason(
|
|||||||
notificationType model.NotificationType,
|
notificationType model.NotificationType,
|
||||||
notificationReason model.NotificationReason,
|
notificationReason model.NotificationReason,
|
||||||
) {
|
) {
|
||||||
if a.Metrics() == nil {
|
if a.notificationMetricsDisabled() {
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !a.Config().FeatureFlags.NotificationMonitoring {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1783,3 +1771,15 @@ func (a *App) CountNotificationReason(
|
|||||||
a.Metrics().IncrementNotificationUnsupportedCounter(notificationType, notificationReason)
|
a.Metrics().IncrementNotificationUnsupportedCounter(notificationType, notificationReason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) notificationMetricsDisabled() bool {
|
||||||
|
if a.Metrics() == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.Config().FeatureFlags.NotificationMonitoring && *a.Config().MetricsSettings.EnableNotificationMetrics {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ func incrementWebsocketCounter(wc *platform.WebConn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !wc.Platform.Config().FeatureFlags.NotificationMonitoring {
|
if !(wc.Platform.Config().FeatureFlags.NotificationMonitoring && *wc.Platform.Config().MetricsSettings.EnableNotificationMetrics) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
|||||||
if *license.Features.Cluster {
|
if *license.Features.Cluster {
|
||||||
props["EnableMetrics"] = strconv.FormatBool(*c.MetricsSettings.Enable)
|
props["EnableMetrics"] = strconv.FormatBool(*c.MetricsSettings.Enable)
|
||||||
props["EnableClientMetrics"] = strconv.FormatBool(c.FeatureFlags.ClientMetrics && *c.MetricsSettings.EnableClientMetrics)
|
props["EnableClientMetrics"] = strconv.FormatBool(c.FeatureFlags.ClientMetrics && *c.MetricsSettings.EnableClientMetrics)
|
||||||
|
props["EnableNotificationMetrics"] = strconv.FormatBool(c.FeatureFlags.NotificationMonitoring && *c.MetricsSettings.EnableNotificationMetrics)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *license.Features.Announcement {
|
if *license.Features.Announcement {
|
||||||
|
|||||||
@@ -980,10 +980,11 @@ func (s *ClusterSettings) SetDefaults() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MetricsSettings struct {
|
type MetricsSettings struct {
|
||||||
Enable *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
Enable *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
||||||
BlockProfileRate *int `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
BlockProfileRate *int `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
||||||
ListenAddress *string `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"` // telemetry: none
|
ListenAddress *string `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||||
EnableClientMetrics *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
EnableClientMetrics *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
||||||
|
EnableNotificationMetrics *bool `access:"environment_performance_monitoring,write_restrictable,cloud_restrictable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MetricsSettings) SetDefaults() {
|
func (s *MetricsSettings) SetDefaults() {
|
||||||
@@ -1002,6 +1003,10 @@ func (s *MetricsSettings) SetDefaults() {
|
|||||||
if s.EnableClientMetrics == nil {
|
if s.EnableClientMetrics == nil {
|
||||||
s.EnableClientMetrics = NewBool(true)
|
s.EnableClientMetrics = NewBool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.EnableNotificationMetrics == nil {
|
||||||
|
s.EnableNotificationMetrics = NewBool(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExperimentalSettings struct {
|
type ExperimentalSettings struct {
|
||||||
|
|||||||
@@ -2376,6 +2376,16 @@ const AdminDefinition: AdminDefinitionType = {
|
|||||||
isHidden: it.not(it.licensedForFeature('IDLoadedPushNotifications')),
|
isHidden: it.not(it.licensedForFeature('IDLoadedPushNotifications')),
|
||||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.SITE.NOTIFICATIONS)),
|
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.SITE.NOTIFICATIONS)),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'bool',
|
||||||
|
key: 'MetricsSettings.EnableNotificationMetrics',
|
||||||
|
label: defineMessage({id: 'admin.metrics.enableNotificationMetricsTitle', defaultMessage: 'Enable Notification Monitoring:'}),
|
||||||
|
help_text: defineMessage({id: 'admin.metrics.enableNotificationMetricsDescription', defaultMessage: 'When true, Mattermost will enable notification data collection for web and Desktop App users.'}),
|
||||||
|
isDisabled: it.any(
|
||||||
|
it.configIsFalse('MetricsSettings', 'Enable'),
|
||||||
|
),
|
||||||
|
isHidden: it.configIsFalse('FeatureFlags', 'NotificationMonitoring'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1489,6 +1489,8 @@
|
|||||||
"admin.metrics.enableClientMetricsDescription": "When true, Mattermost will enable performance monitoring collection for web and desktop app users. Please see <link>documentation</link> to learn more about configuring performance monitoring for Mattermost.",
|
"admin.metrics.enableClientMetricsDescription": "When true, Mattermost will enable performance monitoring collection for web and desktop app users. Please see <link>documentation</link> to learn more about configuring performance monitoring for Mattermost.",
|
||||||
"admin.metrics.enableClientMetricsTitle": "Enable Client Performance Monitoring:",
|
"admin.metrics.enableClientMetricsTitle": "Enable Client Performance Monitoring:",
|
||||||
"admin.metrics.enableDescription": "When true, Mattermost will enable performance monitoring collection and profiling. Please see <link>documentation</link> to learn more about configuring performance monitoring for Mattermost.",
|
"admin.metrics.enableDescription": "When true, Mattermost will enable performance monitoring collection and profiling. Please see <link>documentation</link> to learn more about configuring performance monitoring for Mattermost.",
|
||||||
|
"admin.metrics.enableNotificationMetricsDescription": "When true, Mattermost will enable notification data collection for web and Desktop App users.",
|
||||||
|
"admin.metrics.enableNotificationMetricsTitle": "Enable Notification Monitoring:",
|
||||||
"admin.metrics.enableTitle": "Enable Performance Monitoring:",
|
"admin.metrics.enableTitle": "Enable Performance Monitoring:",
|
||||||
"admin.metrics.listenAddressDesc": "The address the server will listen on to expose performance metrics.",
|
"admin.metrics.listenAddressDesc": "The address the server will listen on to expose performance metrics.",
|
||||||
"admin.metrics.listenAddressEx": "E.g.: \":8067\"",
|
"admin.metrics.listenAddressEx": "E.g.: \":8067\"",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user