Modifies the interface to add search index metrics and initialises metrics first so it can be used from elasticsearch (#13663)

Этот коммит содержится в:
Miguel de la Cruz
2020-01-23 17:10:36 +01:00
коммит произвёл GitHub
родитель 71ceb7f18f
Коммит eb17f8436f
2 изменённых файлов: 6 добавлений и 3 удалений

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

@@ -120,6 +120,9 @@ func RegisterNotificationInterface(f func(*App) einterfaces.NotificationInterfac
} }
func (s *Server) initEnterprise() { func (s *Server) initEnterprise() {
if metricsInterface != nil {
s.Metrics = metricsInterface(s.FakeApp())
}
if accountMigrationInterface != nil { if accountMigrationInterface != nil {
s.AccountMigration = accountMigrationInterface(s) s.AccountMigration = accountMigrationInterface(s)
} }
@@ -135,9 +138,6 @@ func (s *Server) initEnterprise() {
if messageExportInterface != nil { if messageExportInterface != nil {
s.MessageExport = messageExportInterface(s.FakeApp()) s.MessageExport = messageExportInterface(s.FakeApp())
} }
if metricsInterface != nil {
s.Metrics = metricsInterface(s.FakeApp())
}
if notificationInterface != nil { if notificationInterface != nil {
s.Notification = notificationInterface(s.FakeApp()) s.Notification = notificationInterface(s.FakeApp())
} }

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

@@ -45,4 +45,7 @@ type MetricsInterface interface {
ObservePostsSearchDuration(elapsed float64) ObservePostsSearchDuration(elapsed float64)
ObserveStoreMethodDuration(method string, success string, elapsed float64) ObserveStoreMethodDuration(method string, success string, elapsed float64)
ObserveApiEndpointDuration(endpoint string, elapsed float64) ObserveApiEndpointDuration(endpoint string, elapsed float64)
IncrementPostIndexCounter()
IncrementUserIndexCounter()
IncrementChannelIndexCounter()
} }