From c76a571067662031424f012375da11597d3b2a37 Mon Sep 17 00:00:00 2001 From: Giorgi Bochorishvili Date: Thu, 29 Dec 2022 15:40:03 +0400 Subject: [PATCH] Update app layer --- app/app_iface.go | 1 + app/opentracing/opentracing_layer.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/app_iface.go b/app/app_iface.go index f10ca2d8b9..4989828611 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -958,6 +958,7 @@ type AppIface interface { RegenOutgoingWebhookToken(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError) RegenerateOAuthAppSecret(app *model.OAuthApp) (*model.OAuthApp, *model.AppError) RegenerateTeamInviteId(teamID string) (*model.Team, *model.AppError) + RegisterCollectionAndTopic(pluginID, collectionType, topicType string) error RegisterPluginCommand(pluginID string, command *model.Command) error ReloadConfig() error RemoveAllDeactivatedMembersFromChannel(c request.CTX, channel *model.Channel) *model.AppError diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index 367d98ec39..f0282ec2e9 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -13638,6 +13638,28 @@ func (a *OpenTracingAppLayer) RegenerateTeamInviteId(teamID string) (*model.Team return resultVar0, resultVar1 } +func (a *OpenTracingAppLayer) RegisterCollectionAndTopic(pluginID string, collectionType string, topicType string) error { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.RegisterCollectionAndTopic") + + 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.RegisterCollectionAndTopic(pluginID, collectionType, topicType) + + if resultVar0 != nil { + span.LogFields(spanlog.Error(resultVar0)) + ext.Error.Set(span, true) + } + + return resultVar0 +} + func (a *OpenTracingAppLayer) RegisterPluginCommand(pluginID string, command *model.Command) error { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.RegisterPluginCommand")