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
2ed75323
Commit
2ed75323
authored
Sep 26, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal metrics: add grafana version
parent
0778f318
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
pkg/cmd/grafana-server/main.go
+4
-1
pkg/metrics/metrics.go
+10
-1
No files found.
pkg/cmd/grafana-server/main.go
View file @
2ed75323
...
@@ -14,6 +14,7 @@ import (
...
@@ -14,6 +14,7 @@ import (
"net/http"
"net/http"
_
"net/http/pprof"
_
"net/http/pprof"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/setting"
...
@@ -29,7 +30,7 @@ import (
...
@@ -29,7 +30,7 @@ import (
_
"github.com/grafana/grafana/pkg/tsdb/testdata"
_
"github.com/grafana/grafana/pkg/tsdb/testdata"
)
)
var
version
=
"4.
1
.0"
var
version
=
"4.
6
.0"
var
commit
=
"NA"
var
commit
=
"NA"
var
buildstamp
string
var
buildstamp
string
var
build_date
string
var
build_date
string
...
@@ -80,6 +81,8 @@ func main() {
...
@@ -80,6 +81,8 @@ func main() {
setting
.
BuildCommit
=
commit
setting
.
BuildCommit
=
commit
setting
.
BuildStamp
=
buildstampInt64
setting
.
BuildStamp
=
buildstampInt64
metrics
.
M_Grafana_Version
.
WithLabelValues
(
version
)
.
Set
(
1
)
server
:=
NewGrafanaServer
()
server
:=
NewGrafanaServer
()
server
.
Start
()
server
.
Start
()
}
}
...
...
pkg/metrics/metrics.go
View file @
2ed75323
...
@@ -56,6 +56,7 @@ var (
...
@@ -56,6 +56,7 @@ var (
M_StatTotal_Users
prometheus
.
Gauge
M_StatTotal_Users
prometheus
.
Gauge
M_StatTotal_Orgs
prometheus
.
Gauge
M_StatTotal_Orgs
prometheus
.
Gauge
M_StatTotal_Playlists
prometheus
.
Gauge
M_StatTotal_Playlists
prometheus
.
Gauge
M_Grafana_Version
*
prometheus
.
GaugeVec
)
)
func
init
()
{
func
init
()
{
...
@@ -263,6 +264,13 @@ func init() {
...
@@ -263,6 +264,13 @@ func init() {
Help
:
"total amount of playlists"
,
Help
:
"total amount of playlists"
,
Namespace
:
exporterName
,
Namespace
:
exporterName
,
})
})
M_Grafana_Version
=
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Name
:
"info"
,
Help
:
"Information about the Grafana"
,
Namespace
:
exporterName
,
},
[]
string
{
"version"
})
}
}
func
initMetricVars
(
settings
*
MetricSettings
)
{
func
initMetricVars
(
settings
*
MetricSettings
)
{
...
@@ -298,7 +306,8 @@ func initMetricVars(settings *MetricSettings) {
...
@@ -298,7 +306,8 @@ func initMetricVars(settings *MetricSettings) {
M_StatTotal_Dashboards
,
M_StatTotal_Dashboards
,
M_StatTotal_Users
,
M_StatTotal_Users
,
M_StatTotal_Orgs
,
M_StatTotal_Orgs
,
M_StatTotal_Playlists
)
M_StatTotal_Playlists
,
M_Grafana_Version
)
go
instrumentationLoop
(
settings
)
go
instrumentationLoop
(
settings
)
}
}
...
...
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