Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
52403ca1
Commit
52403ca1
authored
Jan 25, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(playlist): add usage statisics
parent
5f1fe135
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletions
+9
-1
pkg/metrics/report_usage.go
+1
-0
pkg/models/stats.go
+1
-0
pkg/services/sqlstore/stats.go
+7
-1
No files found.
pkg/metrics/report_usage.go
View file @
52403ca1
...
@@ -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
{
...
...
pkg/models/stats.go
View file @
52403ca1
...
@@ -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
{
...
...
pkg/services/sqlstore/stats.go
View file @
52403ca1
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment