Commit 2ed75323 by bergquist

internal metrics: add grafana version

parent 0778f318
...@@ -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()
} }
......
...@@ -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)
} }
......
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