diff --git a/store/opentracing_layer.go b/store/opentracing_layer.go index 6027b4c0f9..79adf9a941 100644 --- a/store/opentracing_layer.go +++ b/store/opentracing_layer.go @@ -3247,6 +3247,24 @@ func (s *OpenTracingLayerGroupStore) GetGroups(page int, perPage int, opts model return resultVar0, resultVar1 } +func (s *OpenTracingLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) { + origCtx := s.Root.Store.Context() + span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupsAssociatedToChannelsByTeam") + s.Root.Store.SetContext(newCtx) + defer func() { + s.Root.Store.SetContext(origCtx) + }() + + defer span.Finish() + resultVar0, resultVar1 := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamId, opts) + if resultVar1 != nil { + span.LogFields(spanlog.Error(resultVar1)) + ext.Error.Set(span, true) + } + + return resultVar0, resultVar1 +} + func (s *OpenTracingLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupsByChannel") diff --git a/store/storetest/mocks/GroupStore.go b/store/storetest/mocks/GroupStore.go index cf9d58a696..fb9c818bc1 100644 --- a/store/storetest/mocks/GroupStore.go +++ b/store/storetest/mocks/GroupStore.go @@ -579,31 +579,6 @@ func (_m *GroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpt return r0, r1 } -// GetGroupsByChannel provides a mock function with given fields: channelId, opts -func (_m *GroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { - ret := _m.Called(channelId, opts) - - var r0 []*model.GroupWithSchemeAdmin - if rf, ok := ret.Get(0).(func(string, model.GroupSearchOpts) []*model.GroupWithSchemeAdmin); ok { - r0 = rf(channelId, opts) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*model.GroupWithSchemeAdmin) - } - } - - var r1 *model.AppError - if rf, ok := ret.Get(1).(func(string, model.GroupSearchOpts) *model.AppError); ok { - r1 = rf(channelId, opts) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*model.AppError) - } - } - - return r0, r1 -} - // GetGroupsAssociatedToChannelsByTeam provides a mock function with given fields: teamId, opts func (_m *GroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) { ret := _m.Called(teamId, opts) @@ -629,6 +604,31 @@ func (_m *GroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts mo return r0, r1 } +// GetGroupsByChannel provides a mock function with given fields: channelId, opts +func (_m *GroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { + ret := _m.Called(channelId, opts) + + var r0 []*model.GroupWithSchemeAdmin + if rf, ok := ret.Get(0).(func(string, model.GroupSearchOpts) []*model.GroupWithSchemeAdmin); ok { + r0 = rf(channelId, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*model.GroupWithSchemeAdmin) + } + } + + var r1 *model.AppError + if rf, ok := ret.Get(1).(func(string, model.GroupSearchOpts) *model.AppError); ok { + r1 = rf(channelId, opts) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*model.AppError) + } + } + + return r0, r1 +} + // GetGroupsByTeam provides a mock function with given fields: teamId, opts func (_m *GroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { ret := _m.Called(teamId, opts) diff --git a/store/timer_layer.go b/store/timer_layer.go index f5a51a3416..9eafa9a259 100644 --- a/store/timer_layer.go +++ b/store/timer_layer.go @@ -2974,22 +2974,6 @@ func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.Group return resultVar0, resultVar1 } -func (s *TimerLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { - start := timemodule.Now() - - resultVar0, resultVar1 := s.GroupStore.GetGroupsByChannel(channelId, opts) - - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) - if s.Root.Metrics != nil { - success := "false" - if resultVar1 == nil { - success = "true" - } - s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupsByChannel", success, elapsed) - } - return resultVar0, resultVar1 -} - func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) { start := timemodule.Now() @@ -3006,6 +2990,22 @@ func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string return resultVar0, resultVar1 } +func (s *TimerLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { + start := timemodule.Now() + + resultVar0, resultVar1 := s.GroupStore.GetGroupsByChannel(channelId, opts) + + elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + if s.Root.Metrics != nil { + success := "false" + if resultVar1 == nil { + success = "true" + } + s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupsByChannel", success, elapsed) + } + return resultVar0, resultVar1 +} + func (s *TimerLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) { start := timemodule.Now()