MM-49984: Displaying active search backend in system console (#22721)

This will be shown in the system console to let users know
which search backend is active.

Implemented via adding an extra param in the ping response.

https://mattermost.atlassian.net/browse/MM-49984

```release-note
The database section in the system console now has an additional
read-only section which shows the active search backend in use.

This can be helpful to confirm which is the currently active
search engine when there are multiple of them configured.
```
---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Agniva De Sarker
2023-04-14 14:28:50 +05:30
коммит произвёл GitHub
родитель 4bf31bd227
Коммит 56bf1b695a
12 изменённых файлов: 166 добавлений и 6 удалений

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

@@ -400,6 +400,7 @@ type AppIface interface {
VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError
AccountMigration() einterfaces.AccountMigrationInterface
ActivateMfa(userID, token string) *model.AppError
ActiveSearchBackend() string
AddChannelsToRetentionPolicy(policyID string, channelIDs []string) *model.AppError
AddConfigListener(listener func(*model.Config, *model.Config)) string
AddDirectChannels(c request.CTX, teamID string, user *model.User) *model.AppError

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

@@ -89,6 +89,23 @@ func (a *OpenTracingAppLayer) ActivateMfa(userID string, token string) *model.Ap
return resultVar0
}
func (a *OpenTracingAppLayer) ActiveSearchBackend() string {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ActiveSearchBackend")
a.ctx = newCtx
a.app.Srv().Store().SetContext(newCtx)
defer func() {
a.app.Srv().Store().SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
resultVar0 := a.app.ActiveSearchBackend()
return resultVar0
}
func (a *OpenTracingAppLayer) AddChannelMember(c request.CTX, userID string, channel *model.Channel, opts app.ChannelMemberOpts) (*model.ChannelMember, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.AddChannelMember")

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

@@ -60,3 +60,7 @@ func (a *App) PurgeBleveIndexes() *model.AppError {
}
return nil
}
func (a *App) ActiveSearchBackend() string {
return a.ch.srv.platform.SearchEngine.ActiveEngine()
}