Commit 52403ca1 by bergquist

feat(playlist): add usage statisics

parent 5f1fe135
...@@ -55,6 +55,7 @@ func sendUsageStats() { ...@@ -55,6 +55,7 @@ func sendUsageStats() {
metrics["stats.dashboards.count"] = statsQuery.Result.DashboardCount metrics["stats.dashboards.count"] = statsQuery.Result.DashboardCount
metrics["stats.users.count"] = statsQuery.Result.UserCount metrics["stats.users.count"] = statsQuery.Result.UserCount
metrics["stats.orgs.count"] = statsQuery.Result.OrgCount metrics["stats.orgs.count"] = statsQuery.Result.OrgCount
metrics["stats.playlist.count"] = statsQuery.Result.PlaylistCount
dsStats := m.GetDataSourceStatsQuery{} dsStats := m.GetDataSourceStatsQuery{}
if err := bus.Dispatch(&dsStats); err != nil { if err := bus.Dispatch(&dsStats); err != nil {
......
...@@ -4,6 +4,7 @@ type SystemStats struct { ...@@ -4,6 +4,7 @@ type SystemStats struct {
DashboardCount int DashboardCount int
UserCount int UserCount int
OrgCount int OrgCount int
PlaylistCount int
} }
type DataSourceStats struct { type DataSourceStats struct {
......
package sqlstore package sqlstore
import ( import (
"fmt"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
) )
...@@ -34,7 +36,11 @@ func GetSystemStats(query *m.GetSystemStatsQuery) error { ...@@ -34,7 +36,11 @@ func GetSystemStats(query *m.GetSystemStatsQuery) error {
( (
SELECT COUNT(*) SELECT COUNT(*)
FROM ` + dialect.Quote("dashboard") + ` FROM ` + dialect.Quote("dashboard") + `
) AS dashboard_count ) AS dashboard_count,
(
SELECT COUNT(*)
FROM ` + dialect.Quote("playlist") + `
) AS playlist_count
` `
var stats m.SystemStats var stats m.SystemStats
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment