mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Analytics: Add total dashboard byte size to reporting (#66425)
Co-authored-by: Dan Cech <dcech@grafana.com>
This commit is contained in:
parent
1b46d2f5bd
commit
fef490e4f8
@ -115,6 +115,8 @@ func (s *Service) collectSystemStats(ctx context.Context) (map[string]interface{
|
||||
}
|
||||
|
||||
m["stats.dashboards.count"] = statsResult.Dashboards
|
||||
m["stats.dashboard_bytes.total"] = statsResult.DashboardBytesTotal
|
||||
m["stats.dashboard_bytes.max"] = statsResult.DashboardBytesMax
|
||||
m["stats.users.count"] = statsResult.Users
|
||||
m["stats.admins.count"] = statsResult.Admins
|
||||
m["stats.editors.count"] = statsResult.Editors
|
||||
|
@ -2,6 +2,8 @@ package stats
|
||||
|
||||
type SystemStats struct {
|
||||
Dashboards int64
|
||||
DashboardBytesTotal int64
|
||||
DashboardBytesMax int64
|
||||
Datasources int64
|
||||
Users int64
|
||||
ActiveUsers int64
|
||||
|
@ -89,6 +89,8 @@ func (ss *sqlStatsService) GetSystemStats(ctx context.Context, query *stats.GetS
|
||||
notServiceAccount(dialect)+` AND last_seen_at > ?) AS monthly_active_users,`, monthlyActiveUserDeadlineDate)
|
||||
|
||||
sb.Write(`(SELECT COUNT(id) FROM `+dialect.Quote("dashboard")+` WHERE is_folder = ?) AS dashboards,`, dialect.BooleanStr(false))
|
||||
sb.Write(`(SELECT SUM(LENGTH(data)) FROM `+dialect.Quote("dashboard")+` WHERE is_folder = ?) AS dashboard_bytes_total,`, dialect.BooleanStr(false))
|
||||
sb.Write(`(SELECT MAX(LENGTH(data)) FROM `+dialect.Quote("dashboard")+` WHERE is_folder = ?) AS dashboard_bytes_max,`, dialect.BooleanStr(false))
|
||||
sb.Write(`(SELECT COUNT(id) FROM `+dialect.Quote("dashboard")+` WHERE is_folder = ?) AS folders,`, dialect.BooleanStr(true))
|
||||
|
||||
sb.Write(`(
|
||||
|
Loading…
Reference in New Issue
Block a user