MM-22786 enterprise metrics for logging (#15313)

Adds metrics for logging engine which are collected by Prometheus.
- current queue level(s)
- rate of logging records emitted
- rate of logging errors
Этот коммит содержится в:
Doug Lauder
2020-09-01 10:29:29 -04:00
коммит произвёл GitHub
родитель 22297a9bf4
Коммит 05f1f35a00
20 изменённых файлов: 367 добавлений и 79 удалений

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

@@ -3,6 +3,8 @@
package einterfaces
import "github.com/mattermost/logr"
type MetricsInterface interface {
StartServer()
StopServer()
@@ -56,4 +58,6 @@ type MetricsInterface interface {
ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64)
ObservePluginMultiHookDuration(elapsed float64)
ObservePluginApiDuration(pluginID, apiName string, success bool, elapsed float64)
GetLoggerMetricsCollector() logr.MetricsCollector
}

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

@@ -4,7 +4,10 @@
package mocks
import mock "github.com/stretchr/testify/mock"
import (
logr "github.com/mattermost/logr"
mock "github.com/stretchr/testify/mock"
)
// MetricsInterface is an autogenerated mock type for the MetricsInterface type
type MetricsInterface struct {
@@ -31,6 +34,22 @@ func (_m *MetricsInterface) DecrementWebSocketBroadcastUsersRegistered(hub strin
_m.Called(hub, amount)
}
// GetLoggerMetricsCollector provides a mock function with given fields:
func (_m *MetricsInterface) GetLoggerMetricsCollector() logr.MetricsCollector {
ret := _m.Called()
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
}
// IncrementChannelIndexCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementChannelIndexCounter() {
_m.Called()