mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-21626, MM-21627 - Plugin API/Hooks Prometheus instrumentati… (#13825)
* MM-21626,MM-21627 - Plugin API/Hooks Prometheus instrumentation * Updated einterface mocks * Fixed supervisor tests * ignoring golint errors for plugin metrics wrappers * Making golangci happy * Using variadic form when generating wrapper code * Removed artificial delay * Removed comments from tests * Renaming plugin wrappers to api/hooks_timer_layer * updating vendor dir and mod files * Recording plugin api/hook responses in prometheus * Updated einterfaces-mocks * Updating go sum * Updating go sum * Fixing conflicts * More conflicts fixing Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -48,4 +48,9 @@ type MetricsInterface interface {
|
||||
IncrementPostIndexCounter()
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// AccountMigrationInterface is an autogenerated mock type for the AccountMigrationInterface type
|
||||
type AccountMigrationInterface struct {
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import einterfaces "github.com/mattermost/mattermost-server/v5/einterfaces"
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
einterfaces "github.com/mattermost/mattermost-server/v5/einterfaces"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
// ClusterInterface is an autogenerated mock type for the ClusterInterface type
|
||||
type ClusterInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// ComplianceInterface is an autogenerated mock type for the ComplianceInterface type
|
||||
type ComplianceInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// DataRetentionInterface is an autogenerated mock type for the DataRetentionInterface type
|
||||
type DataRetentionInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// DataRetentionJobInterface is an autogenerated mock type for the DataRetentionJobInterface type
|
||||
type DataRetentionJobInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// ElasticsearchAggregatorInterface is an autogenerated mock type for the ElasticsearchAggregatorInterface type
|
||||
type ElasticsearchAggregatorInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// ElasticsearchIndexerInterface is an autogenerated mock type for the ElasticsearchIndexerInterface type
|
||||
type ElasticsearchIndexerInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// LdapInterface is an autogenerated mock type for the LdapInterface type
|
||||
type LdapInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// LdapSyncInterface is an autogenerated mock type for the LdapSyncInterface type
|
||||
type LdapSyncInterface struct {
|
||||
|
||||
@@ -4,10 +4,13 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import context "context"
|
||||
import (
|
||||
context "context"
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
// MessageExportInterface is an autogenerated mock type for the MessageExportInterface type
|
||||
type MessageExportInterface struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// MessageExportJobInterface is an autogenerated mock type for the MessageExportJobInterface type
|
||||
type MessageExportJobInterface struct {
|
||||
|
||||
@@ -21,6 +21,11 @@ func (_m *MetricsInterface) AddMemCacheMissCounter(cacheName string, amount floa
|
||||
_m.Called(cacheName, amount)
|
||||
}
|
||||
|
||||
// IncrementChannelIndexCounter provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) IncrementChannelIndexCounter() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// IncrementClusterEventType provides a mock function with given fields: eventType
|
||||
func (_m *MetricsInterface) IncrementClusterEventType(eventType string) {
|
||||
_m.Called(eventType)
|
||||
@@ -106,6 +111,11 @@ func (_m *MetricsInterface) IncrementPostFileAttachment(count int) {
|
||||
_m.Called(count)
|
||||
}
|
||||
|
||||
// IncrementPostIndexCounter provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) IncrementPostIndexCounter() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// IncrementPostSentEmail provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) IncrementPostSentEmail() {
|
||||
_m.Called()
|
||||
@@ -121,6 +131,11 @@ func (_m *MetricsInterface) IncrementPostsSearchCounter() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// IncrementUserIndexCounter provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) IncrementUserIndexCounter() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// IncrementWebSocketBroadcast provides a mock function with given fields: eventType
|
||||
func (_m *MetricsInterface) IncrementWebSocketBroadcast(eventType string) {
|
||||
_m.Called(eventType)
|
||||
@@ -136,6 +151,11 @@ func (_m *MetricsInterface) IncrementWebsocketEvent(eventType string) {
|
||||
_m.Called(eventType)
|
||||
}
|
||||
|
||||
// ObserveApiEndpointDuration provides a mock function with given fields: endpoint, method, elapsed
|
||||
func (_m *MetricsInterface) ObserveApiEndpointDuration(endpoint string, method string, elapsed float64) {
|
||||
_m.Called(endpoint, method, elapsed)
|
||||
}
|
||||
|
||||
// ObserveClusterRequestDuration provides a mock function with given fields: elapsed
|
||||
func (_m *MetricsInterface) ObserveClusterRequestDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
@@ -146,11 +166,36 @@ func (_m *MetricsInterface) ObserveHttpRequestDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
}
|
||||
|
||||
// ObservePluginApiDuration provides a mock function with given fields: pluginID, apiName, success, elapsed
|
||||
func (_m *MetricsInterface) ObservePluginApiDuration(pluginID string, apiName string, success bool, elapsed float64) {
|
||||
_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)
|
||||
}
|
||||
|
||||
// ObservePostsSearchDuration provides a mock function with given fields: elapsed
|
||||
func (_m *MetricsInterface) ObservePostsSearchDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// StartServer provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) StartServer() {
|
||||
_m.Called()
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// MfaInterface is an autogenerated mock type for the MfaInterface type
|
||||
type MfaInterface struct {
|
||||
|
||||
56
einterfaces/mocks/NotificationInterface.go
Normal file
56
einterfaces/mocks/NotificationInterface.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// NotificationInterface is an autogenerated mock type for the NotificationInterface type
|
||||
type NotificationInterface struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// CheckLicense provides a mock function with given fields:
|
||||
func (_m *NotificationInterface) CheckLicense() *model.AppError {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// GetNotificationMessage provides a mock function with given fields: ack, userId
|
||||
func (_m *NotificationInterface) GetNotificationMessage(ack *model.PushNotificationAck, userId string) (*model.PushNotification, *model.AppError) {
|
||||
ret := _m.Called(ack, userId)
|
||||
|
||||
var r0 *model.PushNotification
|
||||
if rf, ok := ret.Get(0).(func(*model.PushNotificationAck, string) *model.PushNotification); ok {
|
||||
r0 = rf(ack, userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.PushNotification)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(*model.PushNotificationAck, string) *model.AppError); ok {
|
||||
r1 = rf(ack, userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
@@ -4,9 +4,12 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import io "io"
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
io "io"
|
||||
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// OauthProvider is an autogenerated mock type for the OauthProvider type
|
||||
type OauthProvider struct {
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/v5/model"
|
||||
import (
|
||||
model "github.com/mattermost/mattermost-server/v5/model"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// SamlInterface is an autogenerated mock type for the SamlInterface type
|
||||
type SamlInterface struct {
|
||||
|
||||
Reference in New Issue
Block a user