diff --git a/api4/system_local.go b/api4/system_local.go index 2aeafe15b6..3a6ff47714 100644 --- a/api4/system_local.go +++ b/api4/system_local.go @@ -25,7 +25,7 @@ func localCheckIntegrity(c *Context, w http.ResponseWriter, r *http.Request) { defer c.LogAuditRec(auditRec) var results []model.IntegrityCheckResult - resultsChan := c.App.Srv().Store.CheckIntegrity() + resultsChan := c.App.CheckIntegrity() for result := range resultsChan { results = append(results, result) } diff --git a/app/app.go b/app/app.go index 8e61c94e18..365b0f4be9 100644 --- a/app/app.go +++ b/app/app.go @@ -575,6 +575,10 @@ func (a *App) dbHealthCheckKey() string { return fmt.Sprintf("health_check_%s", a.GetClusterId()) } +func (a *App) CheckIntegrity() <-chan model.IntegrityCheckResult { + return a.Srv().Store.CheckIntegrity() +} + func (a *App) SetServer(srv *Server) { a.srv = srv } diff --git a/app/app_iface.go b/app/app_iface.go index 9bafa8b839..8f271a2ab5 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -429,6 +429,7 @@ type AppIface interface { CheckAndSendUserLimitWarningEmails(c *request.Context) *model.AppError CheckCanInviteToSharedChannel(channelId string) error CheckForClientSideCert(r *http.Request) (string, string, string) + CheckIntegrity() <-chan model.IntegrityCheckResult CheckMandatoryS3Fields(settings *model.FileSettings) *model.AppError CheckPasswordAndAllCriteria(user *model.User, password string, mfaToken string) *model.AppError CheckRolesExist(roleNames []string) *model.AppError diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index 30400a602d..94b7fa68d6 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -1151,6 +1151,23 @@ func (a *OpenTracingAppLayer) CheckForClientSideCert(r *http.Request) (string, s return resultVar0, resultVar1, resultVar2 } +func (a *OpenTracingAppLayer) CheckIntegrity() <-chan model.IntegrityCheckResult { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CheckIntegrity") + + 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.CheckIntegrity() + + return resultVar0 +} + func (a *OpenTracingAppLayer) CheckMandatoryS3Fields(settings *model.FileSettings) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.CheckMandatoryS3Fields")