2025-06-10 14:04:57 -04:00
// Code generated by mockery v2.53.4. DO NOT EDIT.
2019-07-08 11:32:29 -04:00
// Regenerate this file using `make einterfaces-mocks`.
package mocks
2020-09-01 10:29:29 -04:00
import (
2021-08-17 16:08:04 -04:00
logr "github.com/mattermost/logr/v2"
2020-09-01 10:29:29 -04:00
mock "github.com/stretchr/testify/mock"
2021-07-15 01:32:17 -04:00
2023-06-11 01:24:35 -04:00
model "github.com/mattermost/mattermost/server/public/model"
2023-01-10 22:09:54 -05:00
sql "database/sql"
2020-09-01 10:29:29 -04:00
)
2019-07-08 11:32:29 -04:00
// MetricsInterface is an autogenerated mock type for the MetricsInterface type
type MetricsInterface struct {
mock . Mock
}
// AddMemCacheHitCounter provides a mock function with given fields: cacheName, amount
func ( _m * MetricsInterface ) AddMemCacheHitCounter ( cacheName string , amount float64 ) {
_m . Called ( cacheName , amount )
}
// AddMemCacheMissCounter provides a mock function with given fields: cacheName, amount
func ( _m * MetricsInterface ) AddMemCacheMissCounter ( cacheName string , amount float64 ) {
_m . Called ( cacheName , amount )
}
2025-06-10 14:04:57 -04:00
// ClearMobileClientSessionMetadata provides a mock function with no fields
2024-09-24 06:02:19 -04:00
func ( _m * MetricsInterface ) ClearMobileClientSessionMetadata ( ) {
_m . Called ( )
}
2024-04-16 12:49:49 -04:00
// DecrementHTTPWebSockets provides a mock function with given fields: originClient
func ( _m * MetricsInterface ) DecrementHTTPWebSockets ( originClient string ) {
_m . Called ( originClient )
}
2021-01-20 14:43:02 -05:00
// DecrementJobActive provides a mock function with given fields: jobType
func ( _m * MetricsInterface ) DecrementJobActive ( jobType string ) {
_m . Called ( jobType )
}
2020-02-28 05:44:56 -05:00
// DecrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func ( _m * MetricsInterface ) DecrementWebSocketBroadcastBufferSize ( hub string , amount float64 ) {
_m . Called ( hub , amount )
}
2020-03-10 05:15:56 -04:00
// DecrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func ( _m * MetricsInterface ) DecrementWebSocketBroadcastUsersRegistered ( hub string , amount float64 ) {
_m . Called ( hub , amount )
}
2025-06-10 14:04:57 -04:00
// GetLoggerMetricsCollector provides a mock function with no fields
2020-09-01 10:29:29 -04:00
func ( _m * MetricsInterface ) GetLoggerMetricsCollector ( ) logr . MetricsCollector {
ret := _m . Called ( )
2024-04-12 22:45:59 -04:00
if len ( ret ) == 0 {
panic ( "no return value specified for GetLoggerMetricsCollector" )
}
2020-09-01 10:29:29 -04:00
var r0 logr . MetricsCollector
if rf , ok := ret . Get ( 0 ) . ( func ( ) logr . MetricsCollector ) ; ok {
r0 = rf ( )
} else {
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( logr . MetricsCollector )
}
}
return r0
}
2025-06-10 14:04:57 -04:00
// IncrementAccessControlCacheInvalidation provides a mock function with no fields
2025-05-11 16:11:42 -04:00
func ( _m * MetricsInterface ) IncrementAccessControlCacheInvalidation ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementChannelIndexCounter provides a mock function with no fields
2020-02-14 15:47:43 -05:00
func ( _m * MetricsInterface ) IncrementChannelIndexCounter ( ) {
_m . Called ( )
}
2025-02-13 10:40:34 -05:00
// IncrementClientLongTasks provides a mock function with given fields: platform, agent, userID, inc
func ( _m * MetricsInterface ) IncrementClientLongTasks ( platform string , agent string , userID string , inc float64 ) {
_m . Called ( platform , agent , userID , inc )
2024-05-09 14:49:02 -04:00
}
2019-07-08 11:32:29 -04:00
// IncrementClusterEventType provides a mock function with given fields: eventType
2021-07-15 01:32:17 -04:00
func ( _m * MetricsInterface ) IncrementClusterEventType ( eventType model . ClusterEvent ) {
2019-07-08 11:32:29 -04:00
_m . Called ( eventType )
}
2025-06-10 14:04:57 -04:00
// IncrementClusterRequest provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementClusterRequest ( ) {
_m . Called ( )
}
// IncrementEtagHitCounter provides a mock function with given fields: route
func ( _m * MetricsInterface ) IncrementEtagHitCounter ( route string ) {
_m . Called ( route )
}
// IncrementEtagMissCounter provides a mock function with given fields: route
func ( _m * MetricsInterface ) IncrementEtagMissCounter ( route string ) {
_m . Called ( route )
}
2025-06-10 14:04:57 -04:00
// IncrementFileIndexCounter provides a mock function with no fields
2021-01-11 09:14:16 -05:00
func ( _m * MetricsInterface ) IncrementFileIndexCounter ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementFilesSearchCounter provides a mock function with no fields
2021-01-11 09:14:16 -05:00
func ( _m * MetricsInterface ) IncrementFilesSearchCounter ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementHTTPError provides a mock function with no fields
2021-08-12 05:49:16 -04:00
func ( _m * MetricsInterface ) IncrementHTTPError ( ) {
2019-07-08 11:32:29 -04:00
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementHTTPRequest provides a mock function with no fields
2021-08-12 05:49:16 -04:00
func ( _m * MetricsInterface ) IncrementHTTPRequest ( ) {
2019-07-08 11:32:29 -04:00
_m . Called ( )
}
2024-04-16 12:49:49 -04:00
// IncrementHTTPWebSockets provides a mock function with given fields: originClient
func ( _m * MetricsInterface ) IncrementHTTPWebSockets ( originClient string ) {
_m . Called ( originClient )
}
2021-01-20 14:43:02 -05:00
// IncrementJobActive provides a mock function with given fields: jobType
func ( _m * MetricsInterface ) IncrementJobActive ( jobType string ) {
_m . Called ( jobType )
}
2025-06-10 14:04:57 -04:00
// IncrementLogin provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementLogin ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementLoginFail provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementLoginFail ( ) {
_m . Called ( )
}
// IncrementMemCacheHitCounter provides a mock function with given fields: cacheName
func ( _m * MetricsInterface ) IncrementMemCacheHitCounter ( cacheName string ) {
_m . Called ( cacheName )
}
2025-06-10 14:04:57 -04:00
// IncrementMemCacheHitCounterSession provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementMemCacheHitCounterSession ( ) {
_m . Called ( )
}
// IncrementMemCacheInvalidationCounter provides a mock function with given fields: cacheName
func ( _m * MetricsInterface ) IncrementMemCacheInvalidationCounter ( cacheName string ) {
_m . Called ( cacheName )
}
2025-06-10 14:04:57 -04:00
// IncrementMemCacheInvalidationCounterSession provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementMemCacheInvalidationCounterSession ( ) {
_m . Called ( )
}
// IncrementMemCacheMissCounter provides a mock function with given fields: cacheName
func ( _m * MetricsInterface ) IncrementMemCacheMissCounter ( cacheName string ) {
_m . Called ( cacheName )
}
2025-06-10 14:04:57 -04:00
// IncrementMemCacheMissCounterSession provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementMemCacheMissCounterSession ( ) {
_m . Called ( )
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationAckCounter provides a mock function with given fields: notificationType, platform
func ( _m * MetricsInterface ) IncrementNotificationAckCounter ( notificationType model . NotificationType , platform string ) {
_m . Called ( notificationType , platform )
2024-04-18 10:30:08 -04:00
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationCounter provides a mock function with given fields: notificationType, platform
func ( _m * MetricsInterface ) IncrementNotificationCounter ( notificationType model . NotificationType , platform string ) {
_m . Called ( notificationType , platform )
2024-04-18 10:30:08 -04:00
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationErrorCounter provides a mock function with given fields: notificationType, errorReason, platform
func ( _m * MetricsInterface ) IncrementNotificationErrorCounter ( notificationType model . NotificationType , errorReason model . NotificationReason , platform string ) {
_m . Called ( notificationType , errorReason , platform )
2024-04-18 10:30:08 -04:00
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationNotSentCounter provides a mock function with given fields: notificationType, notSentReason, platform
func ( _m * MetricsInterface ) IncrementNotificationNotSentCounter ( notificationType model . NotificationType , notSentReason model . NotificationReason , platform string ) {
_m . Called ( notificationType , notSentReason , platform )
2024-04-18 10:30:08 -04:00
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationSuccessCounter provides a mock function with given fields: notificationType, platform
func ( _m * MetricsInterface ) IncrementNotificationSuccessCounter ( notificationType model . NotificationType , platform string ) {
_m . Called ( notificationType , platform )
2024-04-18 10:30:08 -04:00
}
2024-07-05 03:34:01 -04:00
// IncrementNotificationUnsupportedCounter provides a mock function with given fields: notificationType, notSentReason, platform
func ( _m * MetricsInterface ) IncrementNotificationUnsupportedCounter ( notificationType model . NotificationType , notSentReason model . NotificationReason , platform string ) {
_m . Called ( notificationType , notSentReason , platform )
2024-04-23 17:31:17 -04:00
}
2025-06-10 14:04:57 -04:00
// IncrementPostBroadcast provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementPostBroadcast ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementPostCreate provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementPostCreate ( ) {
_m . Called ( )
}
// IncrementPostFileAttachment provides a mock function with given fields: count
func ( _m * MetricsInterface ) IncrementPostFileAttachment ( count int ) {
_m . Called ( count )
}
2025-06-10 14:04:57 -04:00
// IncrementPostIndexCounter provides a mock function with no fields
2020-02-14 15:47:43 -05:00
func ( _m * MetricsInterface ) IncrementPostIndexCounter ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementPostSentEmail provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementPostSentEmail ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementPostSentPush provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementPostSentPush ( ) {
_m . Called ( )
}
2025-06-10 14:04:57 -04:00
// IncrementPostsSearchCounter provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementPostsSearchCounter ( ) {
_m . Called ( )
}
2021-04-01 13:44:56 -04:00
// IncrementRemoteClusterConnStateChangeCounter provides a mock function with given fields: remoteID, online
func ( _m * MetricsInterface ) IncrementRemoteClusterConnStateChangeCounter ( remoteID string , online bool ) {
_m . Called ( remoteID , online )
}
// IncrementRemoteClusterMsgErrorsCounter provides a mock function with given fields: remoteID, timeout
func ( _m * MetricsInterface ) IncrementRemoteClusterMsgErrorsCounter ( remoteID string , timeout bool ) {
_m . Called ( remoteID , timeout )
}
// IncrementRemoteClusterMsgReceivedCounter provides a mock function with given fields: remoteID
func ( _m * MetricsInterface ) IncrementRemoteClusterMsgReceivedCounter ( remoteID string ) {
_m . Called ( remoteID )
}
// IncrementRemoteClusterMsgSentCounter provides a mock function with given fields: remoteID
func ( _m * MetricsInterface ) IncrementRemoteClusterMsgSentCounter ( remoteID string ) {
_m . Called ( remoteID )
}
2024-02-21 17:21:35 -05:00
// IncrementSharedChannelsSyncCounter provides a mock function with given fields: remoteID
func ( _m * MetricsInterface ) IncrementSharedChannelsSyncCounter ( remoteID string ) {
_m . Called ( remoteID )
}
2025-06-10 14:04:57 -04:00
// IncrementUserIndexCounter provides a mock function with no fields
2020-02-14 15:47:43 -05:00
func ( _m * MetricsInterface ) IncrementUserIndexCounter ( ) {
_m . Called ( )
}
2019-07-08 11:32:29 -04:00
// IncrementWebSocketBroadcast provides a mock function with given fields: eventType
2023-11-22 05:09:48 -05:00
func ( _m * MetricsInterface ) IncrementWebSocketBroadcast ( eventType model . WebsocketEventType ) {
2019-07-08 11:32:29 -04:00
_m . Called ( eventType )
}
2020-02-28 05:44:56 -05:00
// IncrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func ( _m * MetricsInterface ) IncrementWebSocketBroadcastBufferSize ( hub string , amount float64 ) {
_m . Called ( hub , amount )
}
2020-03-10 05:15:56 -04:00
// IncrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func ( _m * MetricsInterface ) IncrementWebSocketBroadcastUsersRegistered ( hub string , amount float64 ) {
_m . Called ( hub , amount )
}
2025-06-10 14:04:57 -04:00
// IncrementWebhookPost provides a mock function with no fields
2019-07-08 11:32:29 -04:00
func ( _m * MetricsInterface ) IncrementWebhookPost ( ) {
_m . Called ( )
}
// IncrementWebsocketEvent provides a mock function with given fields: eventType
2023-11-22 05:09:48 -05:00
func ( _m * MetricsInterface ) IncrementWebsocketEvent ( eventType model . WebsocketEventType ) {
2019-07-08 11:32:29 -04:00
_m . Called ( eventType )
}
2025-05-30 08:15:20 -04:00
// IncrementWebsocketReconnectEventWithDisconnectErrCode provides a mock function with given fields: eventType, disconnectErrCode
func ( _m * MetricsInterface ) IncrementWebsocketReconnectEventWithDisconnectErrCode ( eventType string , disconnectErrCode string ) {
_m . Called ( eventType , disconnectErrCode )
2021-04-29 10:12:48 -04:00
}
2023-10-13 14:59:12 -04:00
// ObserveAPIEndpointDuration provides a mock function with given fields: endpoint, method, statusCode, originClient, pageLoadContext, elapsed
func ( _m * MetricsInterface ) ObserveAPIEndpointDuration ( endpoint string , method string , statusCode string , originClient string , pageLoadContext string , elapsed float64 ) {
_m . Called ( endpoint , method , statusCode , originClient , pageLoadContext , elapsed )
2020-02-14 15:47:43 -05:00
}
2025-05-11 16:11:42 -04:00
// ObserveAccessControlEvaluateDuration provides a mock function with given fields: value
func ( _m * MetricsInterface ) ObserveAccessControlEvaluateDuration ( value float64 ) {
_m . Called ( value )
}
// ObserveAccessControlExpressionCompileDuration provides a mock function with given fields: value
func ( _m * MetricsInterface ) ObserveAccessControlExpressionCompileDuration ( value float64 ) {
_m . Called ( value )
}
2025-05-15 05:33:08 -04:00
// ObserveAccessControlSearchQueryDuration provides a mock function with given fields: value
func ( _m * MetricsInterface ) ObserveAccessControlSearchQueryDuration ( value float64 ) {
_m . Called ( value )
}
2025-02-13 10:40:34 -05:00
// ObserveClientChannelSwitchDuration provides a mock function with given fields: platform, agent, fresh, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientChannelSwitchDuration ( platform string , agent string , fresh string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , fresh , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientCumulativeLayoutShift provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientCumulativeLayoutShift ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientFirstContentfulPaint provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientFirstContentfulPaint ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientInteractionToNextPaint provides a mock function with given fields: platform, agent, interaction, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientInteractionToNextPaint ( platform string , agent string , interaction string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , interaction , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientLargestContentfulPaint provides a mock function with given fields: platform, agent, region, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientLargestContentfulPaint ( platform string , agent string , region string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , region , userID , elapsed )
2024-05-27 14:06:18 -04:00
}
2024-12-04 22:42:54 -05:00
// ObserveClientPageLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientPageLoadDuration ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientRHSLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientRHSLoadDuration ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2024-12-04 22:42:54 -05:00
// ObserveClientSplashScreenEnd provides a mock function with given fields: platform, agent, pageType, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientSplashScreenEnd ( platform string , agent string , pageType string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , pageType , userID , elapsed )
2024-11-29 00:54:35 -05:00
}
2025-02-13 10:40:34 -05:00
// ObserveClientTeamSwitchDuration provides a mock function with given fields: platform, agent, fresh, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientTeamSwitchDuration ( platform string , agent string , fresh string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , fresh , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2024-12-04 22:42:54 -05:00
// ObserveClientTimeToDomInteractive provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientTimeToDomInteractive ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-11-29 00:54:35 -05:00
}
2024-12-04 22:42:54 -05:00
// ObserveClientTimeToFirstByte provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientTimeToFirstByte ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-09 14:49:02 -04:00
}
2024-12-04 22:42:54 -05:00
// ObserveClientTimeToLastByte provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveClientTimeToLastByte ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-11-29 00:54:35 -05:00
}
2019-07-08 11:32:29 -04:00
// ObserveClusterRequestDuration provides a mock function with given fields: elapsed
func ( _m * MetricsInterface ) ObserveClusterRequestDuration ( elapsed float64 ) {
_m . Called ( elapsed )
}
2024-10-22 12:16:20 -04:00
// ObserveDesktopCpuUsage provides a mock function with given fields: platform, version, process, usage
func ( _m * MetricsInterface ) ObserveDesktopCpuUsage ( platform string , version string , process string , usage float64 ) {
_m . Called ( platform , version , process , usage )
}
// ObserveDesktopMemoryUsage provides a mock function with given fields: platform, version, process, usage
func ( _m * MetricsInterface ) ObserveDesktopMemoryUsage ( platform string , version string , process string , usage float64 ) {
_m . Called ( platform , version , process , usage )
}
2020-09-07 09:26:25 -04:00
// ObserveEnabledUsers provides a mock function with given fields: users
func ( _m * MetricsInterface ) ObserveEnabledUsers ( users int64 ) {
_m . Called ( users )
}
2021-01-11 09:14:16 -05:00
// ObserveFilesSearchDuration provides a mock function with given fields: elapsed
func ( _m * MetricsInterface ) ObserveFilesSearchDuration ( elapsed float64 ) {
_m . Called ( elapsed )
}
2025-02-13 10:40:34 -05:00
// ObserveGlobalThreadsLoadDuration provides a mock function with given fields: platform, agent, userID, elapsed
func ( _m * MetricsInterface ) ObserveGlobalThreadsLoadDuration ( platform string , agent string , userID string , elapsed float64 ) {
_m . Called ( platform , agent , userID , elapsed )
2024-05-21 18:04:12 -04:00
}
2024-06-12 05:33:04 -04:00
// ObserveMobileClientChannelSwitchDuration provides a mock function with given fields: platform, elapsed
func ( _m * MetricsInterface ) ObserveMobileClientChannelSwitchDuration ( platform string , elapsed float64 ) {
_m . Called ( platform , elapsed )
}
// ObserveMobileClientLoadDuration provides a mock function with given fields: platform, elapsed
func ( _m * MetricsInterface ) ObserveMobileClientLoadDuration ( platform string , elapsed float64 ) {
_m . Called ( platform , elapsed )
}
2025-01-16 13:03:41 -05:00
// ObserveMobileClientNetworkRequestsAverageSpeed provides a mock function with given fields: platform, agent, networkRequestGroup, speed
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsAverageSpeed ( platform string , agent string , networkRequestGroup string , speed float64 ) {
_m . Called ( platform , agent , networkRequestGroup , speed )
}
// ObserveMobileClientNetworkRequestsEffectiveLatency provides a mock function with given fields: platform, agent, networkRequestGroup, latency
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsEffectiveLatency ( platform string , agent string , networkRequestGroup string , latency float64 ) {
_m . Called ( platform , agent , networkRequestGroup , latency )
}
// ObserveMobileClientNetworkRequestsElapsedTime provides a mock function with given fields: platform, agent, networkRequestGroup, elapsedTime
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsElapsedTime ( platform string , agent string , networkRequestGroup string , elapsedTime float64 ) {
_m . Called ( platform , agent , networkRequestGroup , elapsedTime )
}
// ObserveMobileClientNetworkRequestsLatency provides a mock function with given fields: platform, agent, networkRequestGroup, latency
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsLatency ( platform string , agent string , networkRequestGroup string , latency float64 ) {
_m . Called ( platform , agent , networkRequestGroup , latency )
}
// ObserveMobileClientNetworkRequestsTotalCompressedSize provides a mock function with given fields: platform, agent, networkRequestGroup, size
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsTotalCompressedSize ( platform string , agent string , networkRequestGroup string , size float64 ) {
_m . Called ( platform , agent , networkRequestGroup , size )
}
// ObserveMobileClientNetworkRequestsTotalParallelRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsTotalParallelRequests ( platform string , agent string , networkRequestGroup string , count float64 ) {
_m . Called ( platform , agent , networkRequestGroup , count )
}
// ObserveMobileClientNetworkRequestsTotalRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsTotalRequests ( platform string , agent string , networkRequestGroup string , count float64 ) {
_m . Called ( platform , agent , networkRequestGroup , count )
}
// ObserveMobileClientNetworkRequestsTotalSequentialRequests provides a mock function with given fields: platform, agent, networkRequestGroup, count
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsTotalSequentialRequests ( platform string , agent string , networkRequestGroup string , count float64 ) {
_m . Called ( platform , agent , networkRequestGroup , count )
}
// ObserveMobileClientNetworkRequestsTotalSize provides a mock function with given fields: platform, agent, networkRequestGroup, size
func ( _m * MetricsInterface ) ObserveMobileClientNetworkRequestsTotalSize ( platform string , agent string , networkRequestGroup string , size float64 ) {
_m . Called ( platform , agent , networkRequestGroup , size )
}
2024-09-24 06:02:19 -04:00
// ObserveMobileClientSessionMetadata provides a mock function with given fields: version, platform, value, notificationDisabled
func ( _m * MetricsInterface ) ObserveMobileClientSessionMetadata ( version string , platform string , value float64 , notificationDisabled string ) {
_m . Called ( version , platform , value , notificationDisabled )
}
2024-06-12 05:33:04 -04:00
// ObserveMobileClientTeamSwitchDuration provides a mock function with given fields: platform, elapsed
func ( _m * MetricsInterface ) ObserveMobileClientTeamSwitchDuration ( platform string , elapsed float64 ) {
_m . Called ( platform , elapsed )
}
2021-08-16 13:46:44 -04:00
// ObservePluginAPIDuration provides a mock function with given fields: pluginID, apiName, success, elapsed
func ( _m * MetricsInterface ) ObservePluginAPIDuration ( pluginID string , apiName string , success bool , elapsed float64 ) {
2020-02-14 15:47:43 -05:00
_m . Called ( pluginID , apiName , success , elapsed )
}
// ObservePluginHookDuration provides a mock function with given fields: pluginID, hookName, success, elapsed
func ( _m * MetricsInterface ) ObservePluginHookDuration ( pluginID string , hookName string , success bool , elapsed float64 ) {
_m . Called ( pluginID , hookName , success , elapsed )
}
// ObservePluginMultiHookDuration provides a mock function with given fields: elapsed
func ( _m * MetricsInterface ) ObservePluginMultiHookDuration ( elapsed float64 ) {
_m . Called ( elapsed )
}
// ObservePluginMultiHookIterationDuration provides a mock function with given fields: pluginID, elapsed
func ( _m * MetricsInterface ) ObservePluginMultiHookIterationDuration ( pluginID string , elapsed float64 ) {
_m . Called ( pluginID , elapsed )
}
2019-07-08 11:32:29 -04:00
// ObservePostsSearchDuration provides a mock function with given fields: elapsed
func ( _m * MetricsInterface ) ObservePostsSearchDuration ( elapsed float64 ) {
_m . Called ( elapsed )
}
2024-08-05 23:58:41 -04:00
// ObserveRedisEndpointDuration provides a mock function with given fields: cacheName, operation, elapsed
func ( _m * MetricsInterface ) ObserveRedisEndpointDuration ( cacheName string , operation string , elapsed float64 ) {
_m . Called ( cacheName , operation , elapsed )
}
2021-04-01 13:44:56 -04:00
// ObserveRemoteClusterClockSkew provides a mock function with given fields: remoteID, skew
func ( _m * MetricsInterface ) ObserveRemoteClusterClockSkew ( remoteID string , skew float64 ) {
_m . Called ( remoteID , skew )
}
// ObserveRemoteClusterPingDuration provides a mock function with given fields: remoteID, elapsed
func ( _m * MetricsInterface ) ObserveRemoteClusterPingDuration ( remoteID string , elapsed float64 ) {
_m . Called ( remoteID , elapsed )
}
2024-02-21 17:21:35 -05:00
// ObserveSharedChannelsQueueSize provides a mock function with given fields: size
func ( _m * MetricsInterface ) ObserveSharedChannelsQueueSize ( size int64 ) {
_m . Called ( size )
}
// ObserveSharedChannelsSyncCollectionDuration provides a mock function with given fields: remoteID, elapsed
func ( _m * MetricsInterface ) ObserveSharedChannelsSyncCollectionDuration ( remoteID string , elapsed float64 ) {
_m . Called ( remoteID , elapsed )
}
// ObserveSharedChannelsSyncCollectionStepDuration provides a mock function with given fields: remoteID, step, elapsed
func ( _m * MetricsInterface ) ObserveSharedChannelsSyncCollectionStepDuration ( remoteID string , step string , elapsed float64 ) {
_m . Called ( remoteID , step , elapsed )
}
// ObserveSharedChannelsSyncSendDuration provides a mock function with given fields: remoteID, elapsed
func ( _m * MetricsInterface ) ObserveSharedChannelsSyncSendDuration ( remoteID string , elapsed float64 ) {
_m . Called ( remoteID , elapsed )
}
// ObserveSharedChannelsSyncSendStepDuration provides a mock function with given fields: remoteID, step, elapsed
func ( _m * MetricsInterface ) ObserveSharedChannelsSyncSendStepDuration ( remoteID string , step string , elapsed float64 ) {
_m . Called ( remoteID , step , elapsed )
}
// ObserveSharedChannelsTaskInQueueDuration provides a mock function with given fields: elapsed
func ( _m * MetricsInterface ) ObserveSharedChannelsTaskInQueueDuration ( elapsed float64 ) {
_m . Called ( elapsed )
}
2020-02-14 15:47:43 -05:00
// ObserveStoreMethodDuration provides a mock function with given fields: method, success, elapsed
func ( _m * MetricsInterface ) ObserveStoreMethodDuration ( method string , success string , elapsed float64 ) {
_m . Called ( method , success , elapsed )
}
2025-06-10 14:04:57 -04:00
// Register provides a mock function with no fields
2021-03-12 06:23:24 -05:00
func ( _m * MetricsInterface ) Register ( ) {
2019-07-08 11:32:29 -04:00
_m . Called ( )
}
MM-33818: Add replica lag metric (#17148)
* MM-33818: Add replica lag metric
We add two new metrics for monitoring replica lag:
- Monitor absolute lag based on binlog distance/transaction queue length.
- Monitor time taken for the replica to catch up.
To achieve this, we add a config setting to run a user defined SQL query
on the database.
We need to specify a separate datasource field as part of the config because
in some databases, querying the replica lag value requires elevated credentials
which are not needed for usual running of the application, and can even be a security risk.
Arguably, a peculiar part of the design is the requirement of the query output to be in a (node, value)
format. But since from the application, the SQL query is a black box and the user can set any query
they want, we cannot, in any way templatize this.
And as an extra note, freno also does it in a similar way.
The last bit is because we need to have a separate datasources, now we consume one extra connection
rather than sharing it with the pool. This is an unfortunate result of the design, and while one extra
connection doesn't make much of a difference in a single-tenant scenario. It does make so, in a multi-tenant scenario.
But in a multi-tenant scenario, the expectation would already be to use a connection pool. So this
is not a big concern.
https://mattermost.atlassian.net/browse/MM-33818
```release-note
Two new gauge metrics were added:
mattermost_db_replica_lag_abs and mattermost_db_replica_lag_time, both
containing a label of "node", signifying which db host is the metric from.
These metrics signify the replica lag in absolute terms and in the time dimension
capturing the whole picture of replica lag.
To use these metrics, a separate config section ReplicaLagSettings was added
under SqlSettings. This is an array of maps which contain three keys: DataSource,
QueryAbsoluteLag, and QueryTimeLag. Each map entry is for a single replica instance.
DataSource contains the DB credentials to connect to the replica instance.
QueryAbsoluteLag is a plain SQL query that must return a single row of which the first column
must be the node value of the Prometheus metric, and the second column must be the value of the lag.
QueryTimeLag is the same as above, but used to measure the time lag.
As an example, for AWS Aurora instances, the QueryAbsoluteLag can be:
select server_id, highest_lsn_rcvd-durable_lsn as bindiff from aurora_global_db_instance_status() where server_id=<>
and QueryTimeLag can be:
select server_id, visibility_lag_in_msec from aurora_global_db_instance_status() where server_id=<>
For MySQL Group Replication, the absolute lag can be measured from the number of pending transactions
in the applier queue:
select member_id, count_transaction_remote_in_applier_queue FROM performance_schema.replication_group_member_stats where member_id=<>
Overall, what query to choose is left to the administrator, and depending on the database and need, an appropriate
query can be chosen.
```
* Trigger CI
* Fix tests
* address review comments
* Remove t.Parallel
It was spawning too many connections,
and overloading the docker container.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-29 12:05:24 -04:00
2023-01-10 22:09:54 -05:00
// RegisterDBCollector provides a mock function with given fields: db, name
func ( _m * MetricsInterface ) RegisterDBCollector ( db * sql . DB , name string ) {
_m . Called ( db , name )
}
MM-33818: Add replica lag metric (#17148)
* MM-33818: Add replica lag metric
We add two new metrics for monitoring replica lag:
- Monitor absolute lag based on binlog distance/transaction queue length.
- Monitor time taken for the replica to catch up.
To achieve this, we add a config setting to run a user defined SQL query
on the database.
We need to specify a separate datasource field as part of the config because
in some databases, querying the replica lag value requires elevated credentials
which are not needed for usual running of the application, and can even be a security risk.
Arguably, a peculiar part of the design is the requirement of the query output to be in a (node, value)
format. But since from the application, the SQL query is a black box and the user can set any query
they want, we cannot, in any way templatize this.
And as an extra note, freno also does it in a similar way.
The last bit is because we need to have a separate datasources, now we consume one extra connection
rather than sharing it with the pool. This is an unfortunate result of the design, and while one extra
connection doesn't make much of a difference in a single-tenant scenario. It does make so, in a multi-tenant scenario.
But in a multi-tenant scenario, the expectation would already be to use a connection pool. So this
is not a big concern.
https://mattermost.atlassian.net/browse/MM-33818
```release-note
Two new gauge metrics were added:
mattermost_db_replica_lag_abs and mattermost_db_replica_lag_time, both
containing a label of "node", signifying which db host is the metric from.
These metrics signify the replica lag in absolute terms and in the time dimension
capturing the whole picture of replica lag.
To use these metrics, a separate config section ReplicaLagSettings was added
under SqlSettings. This is an array of maps which contain three keys: DataSource,
QueryAbsoluteLag, and QueryTimeLag. Each map entry is for a single replica instance.
DataSource contains the DB credentials to connect to the replica instance.
QueryAbsoluteLag is a plain SQL query that must return a single row of which the first column
must be the node value of the Prometheus metric, and the second column must be the value of the lag.
QueryTimeLag is the same as above, but used to measure the time lag.
As an example, for AWS Aurora instances, the QueryAbsoluteLag can be:
select server_id, highest_lsn_rcvd-durable_lsn as bindiff from aurora_global_db_instance_status() where server_id=<>
and QueryTimeLag can be:
select server_id, visibility_lag_in_msec from aurora_global_db_instance_status() where server_id=<>
For MySQL Group Replication, the absolute lag can be measured from the number of pending transactions
in the applier queue:
select member_id, count_transaction_remote_in_applier_queue FROM performance_schema.replication_group_member_stats where member_id=<>
Overall, what query to choose is left to the administrator, and depending on the database and need, an appropriate
query can be chosen.
```
* Trigger CI
* Fix tests
* address review comments
* Remove t.Parallel
It was spawning too many connections,
and overloading the docker container.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-29 12:05:24 -04:00
// SetReplicaLagAbsolute provides a mock function with given fields: node, value
func ( _m * MetricsInterface ) SetReplicaLagAbsolute ( node string , value float64 ) {
_m . Called ( node , value )
}
// SetReplicaLagTime provides a mock function with given fields: node, value
func ( _m * MetricsInterface ) SetReplicaLagTime ( node string , value float64 ) {
_m . Called ( node , value )
}
2023-04-10 04:50:57 -04:00
2023-04-19 07:33:18 -04:00
// UnregisterDBCollector provides a mock function with given fields: db, name
func ( _m * MetricsInterface ) UnregisterDBCollector ( db * sql . DB , name string ) {
_m . Called ( db , name )
}
2024-04-12 22:45:59 -04:00
// NewMetricsInterface creates a new instance of MetricsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMetricsInterface ( t interface {
2023-04-10 04:50:57 -04:00
mock . TestingT
Cleanup ( func ( ) )
2024-04-12 22:45:59 -04:00
} ) * MetricsInterface {
2023-04-10 04:50:57 -04:00
mock := & MetricsInterface { }
mock . Mock . Test ( t )
t . Cleanup ( func ( ) { mock . AssertExpectations ( t ) } )
return mock
}