Auth: Add anonymous users view and stats (#78685)
* Add anonymous stats and user table - anonymous users users page - add feature toggle `anonymousAccess` - remove check for enterprise for `Device-Id` header in request - add anonusers/device count to stats * promise all, review comments * make use of promise all settled * refactoring: devices instead of users * review comments, moved countdevices to httpserver * fakeAnonService for tests and generate openapi spec * do not commit openapi3 and api-merged * add openapi * Apply suggestions from code review Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * formatin * precise anon devices to avoid confusion --------- Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: jguer <me@jguer.space>
This commit is contained in:
co-authored by
Alex Khomenko
jguer
parent
fd863cfc93
commit
59bdff0280
@@ -77,6 +77,9 @@ type NotifierUsageStats struct {
|
||||
|
||||
type GetAlertNotifierUsageStatsQuery struct{}
|
||||
|
||||
type AnonymousStats struct {
|
||||
ActiveDevices int64 `json:"activeDevices"`
|
||||
}
|
||||
type AdminStats struct {
|
||||
Orgs int64 `json:"orgs"`
|
||||
Dashboards int64 `json:"dashboards"`
|
||||
@@ -101,6 +104,7 @@ type AdminStats struct {
|
||||
DailyActiveViewers int64 `json:"dailyActiveViewers"`
|
||||
DailyActiveSessions int64 `json:"dailyActiveSessions"`
|
||||
MonthlyActiveUsers int64 `json:"monthlyActiveUsers"`
|
||||
AnonymousStats
|
||||
}
|
||||
|
||||
type GetAdminStatsQuery struct{}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type FakeService struct {
|
||||
ExpectedAdminStats *stats.AdminStats
|
||||
ExpectedSystemStats *stats.SystemStats
|
||||
ExpectedDataSourceStats []*stats.DataSourceStats
|
||||
ExpectedDataSourcesAccessStats []*stats.DataSourceAccessStats
|
||||
@@ -20,7 +21,7 @@ func NewFakeService() *FakeService {
|
||||
}
|
||||
|
||||
func (s *FakeService) GetAdminStats(ctx context.Context, query *stats.GetAdminStatsQuery) (*stats.AdminStats, error) {
|
||||
return nil, s.ExpectedError
|
||||
return s.ExpectedAdminStats, s.ExpectedError
|
||||
}
|
||||
|
||||
func (s *FakeService) GetAlertNotifiersUsageStats(ctx context.Context, query *stats.GetAlertNotifierUsageStatsQuery) ([]*stats.NotifierUsageStats, error) {
|
||||
|
||||
Reference in New Issue
Block a user