* Improve mocking of imported resources in unit tests We have Webpack configured so that, when code imports an image or other resource, the code gets the URL of that image. Jest now matches that behaviour which is needed because React Testing Library would previously throw an error. * Polyfill ResizeObserver in all unit tests * Ensure haveIChannelPermission always returns a boolean value The previous code could sometimes return undefined. While that should behave the same in practice, it can cause React to print prop type warnings * MM-58535 Add region label to LCP metrics * MM-58535 Upgrade web-vitals and add INP attribution * Change new labels to use snake_case * Remove replaceGlobalStore option from renderWithContext I was going to add this in case any tests failed with this option set to false, but after running those tests, that's not the case. I'm going to remove this as an option since it seems more likely than not that anyone using RTL would prefer to have this on.
121 строка
5.3 KiB
Go
121 строка
5.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package einterfaces
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
|
)
|
|
|
|
type MetricsInterface interface {
|
|
Register()
|
|
RegisterDBCollector(db *sql.DB, name string)
|
|
UnregisterDBCollector(db *sql.DB, name string)
|
|
|
|
IncrementPostCreate()
|
|
IncrementWebhookPost()
|
|
IncrementPostSentEmail()
|
|
IncrementPostSentPush()
|
|
IncrementPostBroadcast()
|
|
IncrementPostFileAttachment(count int)
|
|
|
|
IncrementHTTPRequest()
|
|
IncrementHTTPError()
|
|
|
|
IncrementClusterRequest()
|
|
ObserveClusterRequestDuration(elapsed float64)
|
|
IncrementClusterEventType(eventType model.ClusterEvent)
|
|
|
|
IncrementLogin()
|
|
IncrementLoginFail()
|
|
|
|
IncrementEtagHitCounter(route string)
|
|
IncrementEtagMissCounter(route string)
|
|
|
|
IncrementMemCacheHitCounter(cacheName string)
|
|
IncrementMemCacheMissCounter(cacheName string)
|
|
IncrementMemCacheInvalidationCounter(cacheName string)
|
|
IncrementMemCacheMissCounterSession()
|
|
IncrementMemCacheHitCounterSession()
|
|
IncrementMemCacheInvalidationCounterSession()
|
|
|
|
IncrementWebsocketEvent(eventType model.WebsocketEventType)
|
|
IncrementWebSocketBroadcast(eventType model.WebsocketEventType)
|
|
IncrementWebSocketBroadcastBufferSize(hub string, amount float64)
|
|
DecrementWebSocketBroadcastBufferSize(hub string, amount float64)
|
|
IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
|
|
DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
|
|
IncrementWebsocketReconnectEvent(eventType string)
|
|
|
|
IncrementHTTPWebSockets(originClient string)
|
|
DecrementHTTPWebSockets(originClient string)
|
|
|
|
AddMemCacheHitCounter(cacheName string, amount float64)
|
|
AddMemCacheMissCounter(cacheName string, amount float64)
|
|
|
|
IncrementPostsSearchCounter()
|
|
ObservePostsSearchDuration(elapsed float64)
|
|
IncrementFilesSearchCounter()
|
|
ObserveFilesSearchDuration(elapsed float64)
|
|
ObserveStoreMethodDuration(method, success string, elapsed float64)
|
|
ObserveAPIEndpointDuration(endpoint, method, statusCode, originClient, pageLoadContext string, elapsed float64)
|
|
IncrementPostIndexCounter()
|
|
IncrementFileIndexCounter()
|
|
IncrementUserIndexCounter()
|
|
IncrementChannelIndexCounter()
|
|
|
|
ObservePluginHookDuration(pluginID, hookName string, success bool, elapsed float64)
|
|
ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64)
|
|
ObservePluginMultiHookDuration(elapsed float64)
|
|
ObservePluginAPIDuration(pluginID, apiName string, success bool, elapsed float64)
|
|
|
|
ObserveEnabledUsers(users int64)
|
|
GetLoggerMetricsCollector() mlog.MetricsCollector
|
|
|
|
IncrementRemoteClusterMsgSentCounter(remoteID string)
|
|
IncrementRemoteClusterMsgReceivedCounter(remoteID string)
|
|
IncrementRemoteClusterMsgErrorsCounter(remoteID string, timeout bool)
|
|
ObserveRemoteClusterPingDuration(remoteID string, elapsed float64)
|
|
ObserveRemoteClusterClockSkew(remoteID string, skew float64)
|
|
IncrementRemoteClusterConnStateChangeCounter(remoteID string, online bool)
|
|
|
|
IncrementSharedChannelsSyncCounter(remoteID string)
|
|
ObserveSharedChannelsTaskInQueueDuration(elapsed float64)
|
|
ObserveSharedChannelsQueueSize(size int64)
|
|
ObserveSharedChannelsSyncCollectionDuration(remoteID string, elapsed float64)
|
|
ObserveSharedChannelsSyncSendDuration(remoteID string, elapsed float64)
|
|
ObserveSharedChannelsSyncCollectionStepDuration(remoteID string, step string, elapsed float64)
|
|
ObserveSharedChannelsSyncSendStepDuration(remoteID string, step string, elapsed float64)
|
|
|
|
IncrementJobActive(jobType string)
|
|
DecrementJobActive(jobType string)
|
|
|
|
SetReplicaLagAbsolute(node string, value float64)
|
|
SetReplicaLagTime(node string, value float64)
|
|
|
|
IncrementNotificationCounter(notificationType model.NotificationType, platform string)
|
|
IncrementNotificationAckCounter(notificationType model.NotificationType, platform string)
|
|
IncrementNotificationSuccessCounter(notificationType model.NotificationType, platform string)
|
|
IncrementNotificationErrorCounter(notificationType model.NotificationType, errorReason model.NotificationReason, platform string)
|
|
IncrementNotificationNotSentCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string)
|
|
IncrementNotificationUnsupportedCounter(notificationType model.NotificationType, notSentReason model.NotificationReason, platform string)
|
|
|
|
ObserveClientTimeToFirstByte(platform, agent string, elapsed float64)
|
|
ObserveClientFirstContentfulPaint(platform, agent string, elapsed float64)
|
|
ObserveClientLargestContentfulPaint(platform, agent, region string, elapsed float64)
|
|
ObserveClientInteractionToNextPaint(platform, agent, interaction string, elapsed float64)
|
|
ObserveClientCumulativeLayoutShift(platform, agent string, elapsed float64)
|
|
IncrementClientLongTasks(platform, agent string, inc float64)
|
|
ObserveClientPageLoadDuration(platform, agent string, elapsed float64)
|
|
ObserveClientChannelSwitchDuration(platform, agent string, elapsed float64)
|
|
ObserveClientTeamSwitchDuration(platform, agent string, elapsed float64)
|
|
ObserveClientRHSLoadDuration(platform, agent string, elapsed float64)
|
|
ObserveGlobalThreadsLoadDuration(platform, agent string, elapsed float64)
|
|
ObserveMobileClientLoadDuration(platform string, elapsed float64)
|
|
ObserveMobileClientChannelSwitchDuration(platform string, elapsed float64)
|
|
ObserveMobileClientTeamSwitchDuration(platform string, elapsed float64)
|
|
}
|