mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Chore: Remove pkg/models/stats.go (#61613)
* remove pkg/models/stats.go * rename models package in tests
This commit is contained in:
parent
1b86a49622
commit
efed0151f8
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/api/response"
|
"github.com/grafana/grafana/pkg/api/response"
|
||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/models"
|
||||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||||
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
@ -45,7 +46,7 @@ func (hs *HTTPServer) AdminGetSettings(c *models.ReqContext) response.Response {
|
|||||||
// 403: forbiddenError
|
// 403: forbiddenError
|
||||||
// 500: internalServerError
|
// 500: internalServerError
|
||||||
func (hs *HTTPServer) AdminGetStats(c *models.ReqContext) response.Response {
|
func (hs *HTTPServer) AdminGetStats(c *models.ReqContext) response.Response {
|
||||||
statsQuery := models.GetAdminStatsQuery{}
|
statsQuery := stats.GetAdminStatsQuery{}
|
||||||
|
|
||||||
if err := hs.statsService.GetAdminStats(c.Req.Context(), &statsQuery); err != nil {
|
if err := hs.statsService.GetAdminStats(c.Req.Context(), &statsQuery); err != nil {
|
||||||
return response.Error(500, "Failed to get admin stats from database", err)
|
return response.Error(500, "Failed to get admin stats from database", err)
|
||||||
@ -108,5 +109,5 @@ type GetSettingsResponse struct {
|
|||||||
// swagger:response adminGetStatsResponse
|
// swagger:response adminGetStatsResponse
|
||||||
type GetStatsResponse struct {
|
type GetStatsResponse struct {
|
||||||
// in:body
|
// in:body
|
||||||
Body models.AdminStats `json:"body"`
|
Body stats.AdminStats `json:"body"`
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/api/routing"
|
"github.com/grafana/grafana/pkg/api/routing"
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
"github.com/grafana/grafana/pkg/infra/db"
|
"github.com/grafana/grafana/pkg/infra/db"
|
||||||
|
"github.com/grafana/grafana/pkg/infra/db/dbtest"
|
||||||
"github.com/grafana/grafana/pkg/infra/usagestats"
|
"github.com/grafana/grafana/pkg/infra/usagestats"
|
||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/plugins"
|
"github.com/grafana/grafana/pkg/plugins"
|
||||||
@ -63,7 +64,7 @@ func TestGetHomeDashboard(t *testing.T) {
|
|||||||
hs := &HTTPServer{
|
hs := &HTTPServer{
|
||||||
Cfg: cfg,
|
Cfg: cfg,
|
||||||
pluginStore: &plugins.FakePluginStore{},
|
pluginStore: &plugins.FakePluginStore{},
|
||||||
SQLStore: mockstore.NewSQLStoreMock(),
|
SQLStore: dbtest.NewFakeDB(),
|
||||||
preferenceService: prefService,
|
preferenceService: prefService,
|
||||||
dashboardVersionService: dashboardVersionService,
|
dashboardVersionService: dashboardVersionService,
|
||||||
Kinds: corekind.NewBase(nil),
|
Kinds: corekind.NewBase(nil),
|
||||||
@ -140,7 +141,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
q := args.Get(1).(*dashboards.GetDashboardQuery)
|
q := args.Get(1).(*dashboards.GetDashboardQuery)
|
||||||
q.Result = fakeDash
|
q.Result = fakeDash
|
||||||
}).Return(nil)
|
}).Return(nil)
|
||||||
mockSQLStore := mockstore.NewSQLStoreMock()
|
mockSQLStore := dbtest.NewFakeDB()
|
||||||
|
|
||||||
hs := &HTTPServer{
|
hs := &HTTPServer{
|
||||||
Cfg: setting.NewCfg(),
|
Cfg: setting.NewCfg(),
|
||||||
@ -259,7 +260,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}).Return(nil)
|
}).Return(nil)
|
||||||
|
|
||||||
mockSQLStore := mockstore.NewSQLStoreMock()
|
mockSQLStore := dbtest.NewFakeDB()
|
||||||
cfg := setting.NewCfg()
|
cfg := setting.NewCfg()
|
||||||
sql := db.InitTestDB(t)
|
sql := db.InitTestDB(t)
|
||||||
|
|
||||||
@ -803,7 +804,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
sqlmock := mockstore.SQLStoreMock{}
|
sqlmock := dbtest.NewFakeDB()
|
||||||
setUp := func() {
|
setUp := func() {
|
||||||
teamSvc := &teamtest.FakeService{}
|
teamSvc := &teamtest.FakeService{}
|
||||||
dashSvc := dashboards.NewFakeDashboardService(t)
|
dashSvc := dashboards.NewFakeDashboardService(t)
|
||||||
@ -815,7 +816,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
ID: q.ID,
|
ID: q.ID,
|
||||||
}
|
}
|
||||||
}).Return(nil)
|
}).Return(nil)
|
||||||
guardian.InitLegacyGuardian(&sqlmock, dashSvc, teamSvc)
|
guardian.InitLegacyGuardian(sqlmock, dashSvc, teamSvc)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := dtos.CalculateDiffOptions{
|
cmd := dtos.CalculateDiffOptions{
|
||||||
@ -837,7 +838,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
|
|
||||||
callPostDashboard(sc)
|
callPostDashboard(sc)
|
||||||
assert.Equal(t, 403, sc.resp.Code)
|
assert.Equal(t, 403, sc.resp.Code)
|
||||||
}, &sqlmock, fakeDashboardVersionService)
|
}, sqlmock, fakeDashboardVersionService)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("when user does have permission", func(t *testing.T) {
|
t.Run("when user does have permission", func(t *testing.T) {
|
||||||
@ -847,7 +848,7 @@ func TestDashboardAPIEndpoint(t *testing.T) {
|
|||||||
sc.dashboardVersionService = fakeDashboardVersionService
|
sc.dashboardVersionService = fakeDashboardVersionService
|
||||||
callPostDashboard(sc)
|
callPostDashboard(sc)
|
||||||
assert.Equal(t, 200, sc.resp.Code)
|
assert.Equal(t, 200, sc.resp.Code)
|
||||||
}, &sqlmock, fakeDashboardVersionService)
|
}, sqlmock, fakeDashboardVersionService)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/services/contexthandler/ctxkey"
|
"github.com/grafana/grafana/pkg/services/contexthandler/ctxkey"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
|
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
|
||||||
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
"github.com/grafana/grafana/pkg/web"
|
"github.com/grafana/grafana/pkg/web"
|
||||||
@ -49,10 +50,10 @@ func TestApi_getUsageStats(t *testing.T) {
|
|||||||
uss := createService(t, setting.Cfg{}, sqlStore, false)
|
uss := createService(t, setting.Cfg{}, sqlStore, false)
|
||||||
uss.registerAPIEndpoints()
|
uss.registerAPIEndpoints()
|
||||||
|
|
||||||
sqlStore.ExpectedSystemStats = &models.SystemStats{}
|
sqlStore.ExpectedSystemStats = &stats.SystemStats{}
|
||||||
sqlStore.ExpectedDataSourceStats = []*models.DataSourceStats{}
|
sqlStore.ExpectedDataSourceStats = []*stats.DataSourceStats{}
|
||||||
sqlStore.ExpectedDataSourcesAccessStats = []*models.DataSourceAccessStats{}
|
sqlStore.ExpectedDataSourcesAccessStats = []*stats.DataSourceAccessStats{}
|
||||||
sqlStore.ExpectedNotifierUsageStats = []*models.NotifierUsageStats{}
|
sqlStore.ExpectedNotifierUsageStats = []*stats.NotifierUsageStats{}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.desc, func(t *testing.T) {
|
t.Run(tt.desc, func(t *testing.T) {
|
||||||
@ -69,13 +70,13 @@ func TestApi_getUsageStats(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUsageStats(t *testing.T, server *web.Mux) (*models.SystemStats, *httptest.ResponseRecorder) {
|
func getUsageStats(t *testing.T, server *web.Mux) (*stats.SystemStats, *httptest.ResponseRecorder) {
|
||||||
req, err := http.NewRequest(http.MethodGet, "/api/admin/usage-report-preview", http.NoBody)
|
req, err := http.NewRequest(http.MethodGet, "/api/admin/usage-report-preview", http.NoBody)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
recorder := httptest.NewRecorder()
|
recorder := httptest.NewRecorder()
|
||||||
server.ServeHTTP(recorder, req)
|
server.ServeHTTP(recorder, req)
|
||||||
|
|
||||||
var usageStats models.SystemStats
|
var usageStats stats.SystemStats
|
||||||
if recorder.Code == http.StatusOK {
|
if recorder.Code == http.StatusOK {
|
||||||
require.NoError(t, json.NewDecoder(recorder.Body).Decode(&usageStats))
|
require.NoError(t, json.NewDecoder(recorder.Body).Decode(&usageStats))
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||||
"github.com/grafana/grafana/pkg/infra/usagestats"
|
"github.com/grafana/grafana/pkg/infra/usagestats"
|
||||||
"github.com/grafana/grafana/pkg/login/social"
|
"github.com/grafana/grafana/pkg/login/social"
|
||||||
"github.com/grafana/grafana/pkg/models"
|
|
||||||
"github.com/grafana/grafana/pkg/plugins"
|
"github.com/grafana/grafana/pkg/plugins"
|
||||||
"github.com/grafana/grafana/pkg/registry"
|
"github.com/grafana/grafana/pkg/registry"
|
||||||
"github.com/grafana/grafana/pkg/services/datasources"
|
"github.com/grafana/grafana/pkg/services/datasources"
|
||||||
@ -109,7 +108,7 @@ func (s *Service) Run(ctx context.Context) error {
|
|||||||
func (s *Service) collectSystemStats(ctx context.Context) (map[string]interface{}, error) {
|
func (s *Service) collectSystemStats(ctx context.Context) (map[string]interface{}, error) {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
|
|
||||||
statsQuery := models.GetSystemStatsQuery{}
|
statsQuery := stats.GetSystemStatsQuery{}
|
||||||
if err := s.statsService.GetSystemStats(ctx, &statsQuery); err != nil {
|
if err := s.statsService.GetSystemStats(ctx, &statsQuery); err != nil {
|
||||||
s.log.Error("Failed to get system stats", "error", err)
|
s.log.Error("Failed to get system stats", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -222,7 +221,7 @@ func (s *Service) collectAdditionalMetrics(ctx context.Context) (map[string]inte
|
|||||||
func (s *Service) collectAlertNotifierStats(ctx context.Context) (map[string]interface{}, error) {
|
func (s *Service) collectAlertNotifierStats(ctx context.Context) (map[string]interface{}, error) {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
// get stats about alert notifier usage
|
// get stats about alert notifier usage
|
||||||
anStats := models.GetAlertNotifierUsageStatsQuery{}
|
anStats := stats.GetAlertNotifierUsageStatsQuery{}
|
||||||
if err := s.statsService.GetAlertNotifiersUsageStats(ctx, &anStats); err != nil {
|
if err := s.statsService.GetAlertNotifiersUsageStats(ctx, &anStats); err != nil {
|
||||||
s.log.Error("Failed to get alert notification stats", "error", err)
|
s.log.Error("Failed to get alert notification stats", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -236,7 +235,7 @@ func (s *Service) collectAlertNotifierStats(ctx context.Context) (map[string]int
|
|||||||
|
|
||||||
func (s *Service) collectDatasourceStats(ctx context.Context) (map[string]interface{}, error) {
|
func (s *Service) collectDatasourceStats(ctx context.Context) (map[string]interface{}, error) {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
dsStats := models.GetDataSourceStatsQuery{}
|
dsStats := stats.GetDataSourceStatsQuery{}
|
||||||
if err := s.statsService.GetDataSourceStats(ctx, &dsStats); err != nil {
|
if err := s.statsService.GetDataSourceStats(ctx, &dsStats); err != nil {
|
||||||
s.log.Error("Failed to get datasource stats", "error", err)
|
s.log.Error("Failed to get datasource stats", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -283,7 +282,7 @@ func (s *Service) collectDatasourceAccess(ctx context.Context) (map[string]inter
|
|||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
|
|
||||||
// fetch datasource access stats
|
// fetch datasource access stats
|
||||||
dsAccessStats := models.GetDataSourceAccessStatsQuery{}
|
dsAccessStats := stats.GetDataSourceAccessStatsQuery{}
|
||||||
if err := s.statsService.GetDataSourceAccessStats(ctx, &dsAccessStats); err != nil {
|
if err := s.statsService.GetDataSourceAccessStats(ctx, &dsAccessStats); err != nil {
|
||||||
s.log.Error("Failed to get datasource access stats", "error", err)
|
s.log.Error("Failed to get datasource access stats", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -319,7 +318,7 @@ func (s *Service) updateTotalStats(ctx context.Context) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
statsQuery := models.GetSystemStatsQuery{}
|
statsQuery := stats.GetSystemStatsQuery{}
|
||||||
if err := s.statsService.GetSystemStats(ctx, &statsQuery); err != nil {
|
if err := s.statsService.GetSystemStats(ctx, &statsQuery); err != nil {
|
||||||
s.log.Error("Failed to get system stats", "error", err)
|
s.log.Error("Failed to get system stats", "error", err)
|
||||||
return false
|
return false
|
||||||
@ -354,7 +353,7 @@ func (s *Service) updateTotalStats(ctx context.Context) bool {
|
|||||||
|
|
||||||
metrics.MStatTotalPublicDashboards.Set(float64(statsQuery.Result.PublicDashboards))
|
metrics.MStatTotalPublicDashboards.Set(float64(statsQuery.Result.PublicDashboards))
|
||||||
|
|
||||||
dsStats := models.GetDataSourceStatsQuery{}
|
dsStats := stats.GetDataSourceStatsQuery{}
|
||||||
if err := s.statsService.GetDataSourceStats(ctx, &dsStats); err != nil {
|
if err := s.statsService.GetDataSourceStats(ctx, &dsStats); err != nil {
|
||||||
s.log.Error("Failed to get datasource stats", "error", err)
|
s.log.Error("Failed to get datasource stats", "error", err)
|
||||||
return true
|
return true
|
||||||
|
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/infra/httpclient"
|
"github.com/grafana/grafana/pkg/infra/httpclient"
|
||||||
"github.com/grafana/grafana/pkg/infra/usagestats"
|
"github.com/grafana/grafana/pkg/infra/usagestats"
|
||||||
"github.com/grafana/grafana/pkg/login/social"
|
"github.com/grafana/grafana/pkg/login/social"
|
||||||
"github.com/grafana/grafana/pkg/models"
|
|
||||||
"github.com/grafana/grafana/pkg/plugins"
|
"github.com/grafana/grafana/pkg/plugins"
|
||||||
"github.com/grafana/grafana/pkg/registry"
|
"github.com/grafana/grafana/pkg/registry"
|
||||||
"github.com/grafana/grafana/pkg/services/datasources"
|
"github.com/grafana/grafana/pkg/services/datasources"
|
||||||
@ -36,7 +35,7 @@ func TestTotalStatsUpdate(t *testing.T) {
|
|||||||
s.cfg.MetricsEndpointEnabled = true
|
s.cfg.MetricsEndpointEnabled = true
|
||||||
s.cfg.MetricsEndpointDisableTotalStats = false
|
s.cfg.MetricsEndpointDisableTotalStats = false
|
||||||
|
|
||||||
statsService.ExpectedSystemStats = &models.SystemStats{}
|
statsService.ExpectedSystemStats = &stats.SystemStats{}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
MetricsEndpointEnabled bool
|
MetricsEndpointEnabled bool
|
||||||
@ -254,7 +253,7 @@ func TestDatasourceStats(t *testing.T) {
|
|||||||
|
|
||||||
setupSomeDataSourcePlugins(t, s)
|
setupSomeDataSourcePlugins(t, s)
|
||||||
|
|
||||||
statsService.ExpectedDataSourceStats = []*models.DataSourceStats{
|
statsService.ExpectedDataSourceStats = []*stats.DataSourceStats{
|
||||||
{
|
{
|
||||||
Type: datasources.DS_ES,
|
Type: datasources.DS_ES,
|
||||||
Count: 9,
|
Count: 9,
|
||||||
@ -291,7 +290,7 @@ func TestDatasourceStats(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
statsService.ExpectedDataSourcesAccessStats = []*models.DataSourceAccessStats{
|
statsService.ExpectedDataSourcesAccessStats = []*stats.DataSourceAccessStats{
|
||||||
{
|
{
|
||||||
Type: datasources.DS_ES,
|
Type: datasources.DS_ES,
|
||||||
Access: "direct",
|
Access: "direct",
|
||||||
@ -360,7 +359,7 @@ func TestAlertNotifiersStats(t *testing.T) {
|
|||||||
statsService := statstest.NewFakeService()
|
statsService := statstest.NewFakeService()
|
||||||
s := createService(t, &setting.Cfg{}, sqlStore, statsService)
|
s := createService(t, &setting.Cfg{}, sqlStore, statsService)
|
||||||
|
|
||||||
statsService.ExpectedNotifierUsageStats = []*models.NotifierUsageStats{
|
statsService.ExpectedNotifierUsageStats = []*stats.NotifierUsageStats{
|
||||||
{
|
{
|
||||||
Type: "slack",
|
Type: "slack",
|
||||||
Count: 1,
|
Count: 1,
|
||||||
@ -379,7 +378,7 @@ func TestAlertNotifiersStats(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func mockSystemStats(statsService *statstest.FakeService) {
|
func mockSystemStats(statsService *statstest.FakeService) {
|
||||||
statsService.ExpectedSystemStats = &models.SystemStats{
|
statsService.ExpectedSystemStats = &stats.SystemStats{
|
||||||
Dashboards: 1,
|
Dashboards: 1,
|
||||||
Datasources: 2,
|
Datasources: 2,
|
||||||
Users: 3,
|
Users: 3,
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
||||||
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
"github.com/grafana/grafana/pkg/services/team"
|
"github.com/grafana/grafana/pkg/services/team"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
)
|
)
|
||||||
@ -23,10 +24,10 @@ type SQLStoreMock struct {
|
|||||||
ExpectedUser *user.User
|
ExpectedUser *user.User
|
||||||
ExpectedTeamsByUser []*team.TeamDTO
|
ExpectedTeamsByUser []*team.TeamDTO
|
||||||
ExpectedAlert *models.Alert
|
ExpectedAlert *models.Alert
|
||||||
ExpectedSystemStats *models.SystemStats
|
ExpectedSystemStats *stats.SystemStats
|
||||||
ExpectedDataSourceStats []*models.DataSourceStats
|
ExpectedDataSourceStats []*stats.DataSourceStats
|
||||||
ExpectedDataSourcesAccessStats []*models.DataSourceAccessStats
|
ExpectedDataSourcesAccessStats []*stats.DataSourceAccessStats
|
||||||
ExpectedNotifierUsageStats []*models.NotifierUsageStats
|
ExpectedNotifierUsageStats []*stats.NotifierUsageStats
|
||||||
ExpectedSignedInUser *user.SignedInUser
|
ExpectedSignedInUser *user.SignedInUser
|
||||||
|
|
||||||
ExpectedError error
|
ExpectedError error
|
||||||
@ -36,30 +37,6 @@ func NewSQLStoreMock() *SQLStoreMock {
|
|||||||
return &SQLStoreMock{}
|
return &SQLStoreMock{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error {
|
|
||||||
return m.ExpectedError
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error {
|
|
||||||
query.Result = m.ExpectedNotifierUsageStats
|
|
||||||
return m.ExpectedError
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error {
|
|
||||||
query.Result = m.ExpectedDataSourceStats
|
|
||||||
return m.ExpectedError
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error {
|
|
||||||
query.Result = m.ExpectedDataSourcesAccessStats
|
|
||||||
return m.ExpectedError
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error {
|
|
||||||
query.Result = m.ExpectedSystemStats
|
|
||||||
return m.ExpectedError
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SQLStoreMock) GetDialect() migrator.Dialect {
|
func (m *SQLStoreMock) GetDialect() migrator.Dialect {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/infra/localcache"
|
"github.com/grafana/grafana/pkg/infra/localcache"
|
||||||
"github.com/grafana/grafana/pkg/infra/log"
|
"github.com/grafana/grafana/pkg/infra/log"
|
||||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||||
"github.com/grafana/grafana/pkg/models"
|
|
||||||
"github.com/grafana/grafana/pkg/registry"
|
"github.com/grafana/grafana/pkg/registry"
|
||||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
||||||
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
"github.com/grafana/grafana/pkg/util"
|
"github.com/grafana/grafana/pkg/util"
|
||||||
@ -202,7 +202,7 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser(test bool) error {
|
|||||||
|
|
||||||
// If this is a test database, don't exit early when any user is found.
|
// If this is a test database, don't exit early when any user is found.
|
||||||
if !test {
|
if !test {
|
||||||
var stats models.SystemUserCountStats
|
var stats stats.SystemUserCountStats
|
||||||
// TODO: Should be able to rename "Count" to "count", for more standard SQL style
|
// TODO: Should be able to rename "Count" to "count", for more standard SQL style
|
||||||
// Just have to make sure it gets deserialized properly into models.SystemUserCountStats
|
// Just have to make sure it gets deserialized properly into models.SystemUserCountStats
|
||||||
rawSQL := `SELECT COUNT(id) AS Count FROM ` + ss.Dialect.Quote("user")
|
rawSQL := `SELECT COUNT(id) AS Count FROM ` + ss.Dialect.Quote("user")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package models
|
package stats
|
||||||
|
|
||||||
type SystemStats struct {
|
type SystemStats struct {
|
||||||
Dashboards int64
|
Dashboards int64
|
@ -2,15 +2,13 @@ package stats
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service interface {
|
type Service interface {
|
||||||
GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error
|
GetAdminStats(ctx context.Context, query *GetAdminStatsQuery) error
|
||||||
GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error
|
GetAlertNotifiersUsageStats(ctx context.Context, query *GetAlertNotifierUsageStatsQuery) error
|
||||||
GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error
|
GetDataSourceStats(ctx context.Context, query *GetDataSourceStatsQuery) error
|
||||||
GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error
|
GetDataSourceAccessStats(ctx context.Context, query *GetDataSourceAccessStatsQuery) error
|
||||||
GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error
|
GetSystemStats(ctx context.Context, query *GetSystemStatsQuery) error
|
||||||
GetSystemUserCountStats(ctx context.Context, query *models.GetSystemUserCountStatsQuery) error
|
GetSystemUserCountStats(ctx context.Context, query *GetSystemUserCountStatsQuery) error
|
||||||
}
|
}
|
||||||
|
@ -21,28 +21,28 @@ func ProvideService(db db.DB) stats.Service {
|
|||||||
|
|
||||||
type sqlStatsService struct{ db db.DB }
|
type sqlStatsService struct{ db db.DB }
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error {
|
func (ss *sqlStatsService) GetAlertNotifiersUsageStats(ctx context.Context, query *stats.GetAlertNotifierUsageStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||||
var rawSQL = `SELECT COUNT(*) AS count, type FROM ` + ss.db.GetDialect().Quote("alert_notification") + ` GROUP BY type`
|
var rawSQL = `SELECT COUNT(*) AS count, type FROM ` + ss.db.GetDialect().Quote("alert_notification") + ` GROUP BY type`
|
||||||
query.Result = make([]*models.NotifierUsageStats, 0)
|
query.Result = make([]*stats.NotifierUsageStats, 0)
|
||||||
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error {
|
func (ss *sqlStatsService) GetDataSourceStats(ctx context.Context, query *stats.GetDataSourceStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||||
var rawSQL = `SELECT COUNT(*) AS count, type FROM ` + ss.db.GetDialect().Quote("data_source") + ` GROUP BY type`
|
var rawSQL = `SELECT COUNT(*) AS count, type FROM ` + ss.db.GetDialect().Quote("data_source") + ` GROUP BY type`
|
||||||
query.Result = make([]*models.DataSourceStats, 0)
|
query.Result = make([]*stats.DataSourceStats, 0)
|
||||||
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error {
|
func (ss *sqlStatsService) GetDataSourceAccessStats(ctx context.Context, query *stats.GetDataSourceAccessStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||||
var rawSQL = `SELECT COUNT(*) AS count, type, access FROM ` + ss.db.GetDialect().Quote("data_source") + ` GROUP BY type, access`
|
var rawSQL = `SELECT COUNT(*) AS count, type, access FROM ` + ss.db.GetDialect().Quote("data_source") + ` GROUP BY type, access`
|
||||||
query.Result = make([]*models.DataSourceAccessStats, 0)
|
query.Result = make([]*stats.DataSourceAccessStats, 0)
|
||||||
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
err := dbSession.SQL(rawSQL).Find(&query.Result)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
@ -53,7 +53,7 @@ func notServiceAccount(dialect migrator.Dialect) string {
|
|||||||
dialect.BooleanStr(false)
|
dialect.BooleanStr(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error {
|
func (ss *sqlStatsService) GetSystemStats(ctx context.Context, query *stats.GetSystemStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||||
sb := &db.SQLBuilder{}
|
sb := &db.SQLBuilder{}
|
||||||
sb.Write("SELECT ")
|
sb.Write("SELECT ")
|
||||||
@ -120,7 +120,7 @@ func (ss *sqlStatsService) GetSystemStats(ctx context.Context, query *models.Get
|
|||||||
|
|
||||||
sb.Write(ss.roleCounterSQL(ctx))
|
sb.Write(ss.roleCounterSQL(ctx))
|
||||||
|
|
||||||
var stats models.SystemStats
|
var stats stats.SystemStats
|
||||||
_, err := dbSession.SQL(sb.GetSQLString(), sb.GetParams()...).Get(&stats)
|
_, err := dbSession.SQL(sb.GetSQLString(), sb.GetParams()...).Get(&stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -164,7 +164,7 @@ func viewersPermissionsCounterSQL(db db.DB, statName string, isFolder bool, perm
|
|||||||
) AS ` + statName + `, `
|
) AS ` + statName + `, `
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error {
|
func (ss *sqlStatsService) GetAdminStats(ctx context.Context, query *stats.GetAdminStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(dbSession *db.Session) error {
|
||||||
dialect := ss.db.GetDialect()
|
dialect := ss.db.GetDialect()
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
@ -231,7 +231,7 @@ func (ss *sqlStatsService) GetAdminStats(ctx context.Context, query *models.GetA
|
|||||||
FROM ` + dialect.Quote("user_auth_token") + ` WHERE rotated_at > ?
|
FROM ` + dialect.Quote("user_auth_token") + ` WHERE rotated_at > ?
|
||||||
) AS daily_active_sessions`
|
) AS daily_active_sessions`
|
||||||
|
|
||||||
var stats models.AdminStats
|
var stats stats.AdminStats
|
||||||
_, err := dbSession.SQL(rawSQL, activeEndDate, dailyActiveEndDate, monthlyActiveEndDate, activeEndDate.Unix(), dailyActiveEndDate.Unix()).Get(&stats)
|
_, err := dbSession.SQL(rawSQL, activeEndDate, dailyActiveEndDate, monthlyActiveEndDate, activeEndDate.Unix(), dailyActiveEndDate.Unix()).Get(&stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -242,10 +242,10 @@ func (ss *sqlStatsService) GetAdminStats(ctx context.Context, query *models.GetA
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sqlStatsService) GetSystemUserCountStats(ctx context.Context, query *models.GetSystemUserCountStatsQuery) error {
|
func (ss *sqlStatsService) GetSystemUserCountStats(ctx context.Context, query *stats.GetSystemUserCountStatsQuery) error {
|
||||||
return ss.db.WithDbSession(ctx, func(sess *db.Session) error {
|
return ss.db.WithDbSession(ctx, func(sess *db.Session) error {
|
||||||
var rawSQL = `SELECT COUNT(id) AS Count FROM ` + ss.db.GetDialect().Quote("user")
|
var rawSQL = `SELECT COUNT(id) AS Count FROM ` + ss.db.GetDialect().Quote("user")
|
||||||
var stats models.SystemUserCountStats
|
var stats stats.SystemUserCountStats
|
||||||
_, err := sess.SQL(rawSQL).Get(&stats)
|
_, err := sess.SQL(rawSQL).Get(&stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -269,9 +269,9 @@ func (ss *sqlStatsService) updateUserRoleCountsIfNecessary(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
type memoUserStats struct {
|
type memoUserStats struct {
|
||||||
active models.UserStats
|
active stats.UserStats
|
||||||
dailyActive models.UserStats
|
dailyActive stats.UserStats
|
||||||
total models.UserStats
|
total stats.UserStats
|
||||||
|
|
||||||
memoized time.Time
|
memoized time.Time
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ GROUP BY active, daily_active, role;`
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func addToStats(base models.UserStats, role org.RoleType, count int64) models.UserStats {
|
func addToStats(base stats.UserStats, role org.RoleType, count int64) stats.UserStats {
|
||||||
base.Users += count
|
base.Users += count
|
||||||
|
|
||||||
switch role {
|
switch role {
|
||||||
|
@ -8,11 +8,11 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/models"
|
|
||||||
"github.com/grafana/grafana/pkg/services/org"
|
"github.com/grafana/grafana/pkg/services/org"
|
||||||
"github.com/grafana/grafana/pkg/services/org/orgimpl"
|
"github.com/grafana/grafana/pkg/services/org/orgimpl"
|
||||||
"github.com/grafana/grafana/pkg/services/quota/quotatest"
|
"github.com/grafana/grafana/pkg/services/quota/quotatest"
|
||||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||||
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||||
)
|
)
|
||||||
@ -26,7 +26,7 @@ func TestIntegrationStatsDataAccess(t *testing.T) {
|
|||||||
populateDB(t, db)
|
populateDB(t, db)
|
||||||
|
|
||||||
t.Run("Get system stats should not results in error", func(t *testing.T) {
|
t.Run("Get system stats should not results in error", func(t *testing.T) {
|
||||||
query := models.GetSystemStatsQuery{}
|
query := stats.GetSystemStatsQuery{}
|
||||||
err := statsService.GetSystemStats(context.Background(), &query)
|
err := statsService.GetSystemStats(context.Background(), &query)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, int64(3), query.Result.Users)
|
assert.Equal(t, int64(3), query.Result.Users)
|
||||||
@ -39,31 +39,31 @@ func TestIntegrationStatsDataAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Get system user count stats should not results in error", func(t *testing.T) {
|
t.Run("Get system user count stats should not results in error", func(t *testing.T) {
|
||||||
query := models.GetSystemUserCountStatsQuery{}
|
query := stats.GetSystemUserCountStatsQuery{}
|
||||||
err := statsService.GetSystemUserCountStats(context.Background(), &query)
|
err := statsService.GetSystemUserCountStats(context.Background(), &query)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Get datasource stats should not results in error", func(t *testing.T) {
|
t.Run("Get datasource stats should not results in error", func(t *testing.T) {
|
||||||
query := models.GetDataSourceStatsQuery{}
|
query := stats.GetDataSourceStatsQuery{}
|
||||||
err := statsService.GetDataSourceStats(context.Background(), &query)
|
err := statsService.GetDataSourceStats(context.Background(), &query)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Get datasource access stats should not results in error", func(t *testing.T) {
|
t.Run("Get datasource access stats should not results in error", func(t *testing.T) {
|
||||||
query := models.GetDataSourceAccessStatsQuery{}
|
query := stats.GetDataSourceAccessStatsQuery{}
|
||||||
err := statsService.GetDataSourceAccessStats(context.Background(), &query)
|
err := statsService.GetDataSourceAccessStats(context.Background(), &query)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Get alert notifier stats should not results in error", func(t *testing.T) {
|
t.Run("Get alert notifier stats should not results in error", func(t *testing.T) {
|
||||||
query := models.GetAlertNotifierUsageStatsQuery{}
|
query := stats.GetAlertNotifierUsageStatsQuery{}
|
||||||
err := statsService.GetAlertNotifiersUsageStats(context.Background(), &query)
|
err := statsService.GetAlertNotifiersUsageStats(context.Background(), &query)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Get admin stats should not result in error", func(t *testing.T) {
|
t.Run("Get admin stats should not result in error", func(t *testing.T) {
|
||||||
query := models.GetAdminStatsQuery{}
|
query := stats.GetAdminStatsQuery{}
|
||||||
err := statsService.GetAdminStats(context.Background(), &query)
|
err := statsService.GetAdminStats(context.Background(), &query)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
@ -123,7 +123,7 @@ func TestIntegration_GetAdminStats(t *testing.T) {
|
|||||||
db := sqlstore.InitTestDB(t)
|
db := sqlstore.InitTestDB(t)
|
||||||
statsService := ProvideService(db)
|
statsService := ProvideService(db)
|
||||||
|
|
||||||
query := models.GetAdminStatsQuery{}
|
query := stats.GetAdminStatsQuery{}
|
||||||
err := statsService.GetAdminStats(context.Background(), &query)
|
err := statsService.GetAdminStats(context.Background(), &query)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ package statstest
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/services/stats"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FakeService struct {
|
type FakeService struct {
|
||||||
ExpectedSystemStats *models.SystemStats
|
ExpectedSystemStats *stats.SystemStats
|
||||||
ExpectedDataSourceStats []*models.DataSourceStats
|
ExpectedDataSourceStats []*stats.DataSourceStats
|
||||||
ExpectedDataSourcesAccessStats []*models.DataSourceAccessStats
|
ExpectedDataSourcesAccessStats []*stats.DataSourceAccessStats
|
||||||
ExpectedNotifierUsageStats []*models.NotifierUsageStats
|
ExpectedNotifierUsageStats []*stats.NotifierUsageStats
|
||||||
|
|
||||||
ExpectedError error
|
ExpectedError error
|
||||||
}
|
}
|
||||||
@ -19,30 +19,30 @@ func NewFakeService() *FakeService {
|
|||||||
return &FakeService{}
|
return &FakeService{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error {
|
func (s *FakeService) GetAdminStats(ctx context.Context, query *stats.GetAdminStatsQuery) error {
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error {
|
func (s *FakeService) GetAlertNotifiersUsageStats(ctx context.Context, query *stats.GetAlertNotifierUsageStatsQuery) error {
|
||||||
query.Result = s.ExpectedNotifierUsageStats
|
query.Result = s.ExpectedNotifierUsageStats
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error {
|
func (s *FakeService) GetDataSourceStats(ctx context.Context, query *stats.GetDataSourceStatsQuery) error {
|
||||||
query.Result = s.ExpectedDataSourceStats
|
query.Result = s.ExpectedDataSourceStats
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error {
|
func (s *FakeService) GetDataSourceAccessStats(ctx context.Context, query *stats.GetDataSourceAccessStatsQuery) error {
|
||||||
query.Result = s.ExpectedDataSourcesAccessStats
|
query.Result = s.ExpectedDataSourcesAccessStats
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error {
|
func (s *FakeService) GetSystemStats(ctx context.Context, query *stats.GetSystemStatsQuery) error {
|
||||||
query.Result = s.ExpectedSystemStats
|
query.Result = s.ExpectedSystemStats
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FakeService) GetSystemUserCountStats(ctx context.Context, query *models.GetSystemUserCountStatsQuery) error {
|
func (s *FakeService) GetSystemUserCountStats(ctx context.Context, query *stats.GetSystemUserCountStatsQuery) error {
|
||||||
return s.ExpectedError
|
return s.ExpectedError
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user