mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed api bugs, stats endpoint working
This commit is contained in:
parent
c7fae5386d
commit
da67afa51e
@ -3,10 +3,10 @@ package api
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/middleware"
|
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
|
"github.com/grafana/grafana/pkg/middleware"
|
||||||
m "github.com/grafana/grafana/pkg/models"
|
m "github.com/grafana/grafana/pkg/models"
|
||||||
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AdminGetSettings(c *middleware.Context) {
|
func AdminGetSettings(c *middleware.Context) {
|
||||||
|
@ -20,14 +20,14 @@ type GetDataSourceStatsQuery struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AdminStats struct {
|
type AdminStats struct {
|
||||||
UserCount int
|
UserCount int `json:"user_count"`
|
||||||
OrgCount int
|
OrgCount int `json:"org_count"`
|
||||||
DashboardCount int
|
DashboardCount int `json:"dashboard_count"`
|
||||||
DBSnapshotCount int
|
DbSnapshotCount int `json:"db_snapshot_count"`
|
||||||
DBTagCount int
|
DbTagCount int `json:"db_tag_count"`
|
||||||
DataSourceCount int
|
DataSourceCount int `json:"data_source_count"`
|
||||||
PlaylistCount int
|
PlaylistCount int `json:"playlist_count"`
|
||||||
StarredDBCount int
|
StarredDbCount int `json:"starred_db_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetAdminStatsQuery struct {
|
type GetAdminStatsQuery struct {
|
||||||
|
@ -73,13 +73,13 @@ func GetAdminStats(query *m.GetAdminStatsQuery) error {
|
|||||||
(
|
(
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM ` + dialect.Quote("data_source") + `
|
FROM ` + dialect.Quote("data_source") + `
|
||||||
) AS datasource_count,
|
) AS data_source_count,
|
||||||
(
|
(
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM ` + dialect.Quote("playlist") + `
|
FROM ` + dialect.Quote("playlist") + `
|
||||||
) AS playlist_count,
|
) AS playlist_count,
|
||||||
(
|
(
|
||||||
SELECT DISTINCT(dashboard_id)
|
SELECT COUNT (DISTINCT ` + dialect.Quote("dashboard_id") + ` )
|
||||||
FROM ` + dialect.Quote("star") + `
|
FROM ` + dialect.Quote("star") + `
|
||||||
) AS starred_db_count
|
) AS starred_db_count
|
||||||
`
|
`
|
||||||
|
Loading…
Reference in New Issue
Block a user