mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(instrumentation): check if enabled in http api metrics route
This commit is contained in:
parent
1059a35bbc
commit
7cbaf06097
@ -9,6 +9,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/metrics"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
func GetTestMetrics(c *middleware.Context) {
|
||||
@ -40,6 +41,10 @@ func GetTestMetrics(c *middleware.Context) {
|
||||
}
|
||||
|
||||
func GetInternalMetrics(c *middleware.Context) Response {
|
||||
if metrics.UseNilMetrics {
|
||||
return Json(200, util.DynMap{"message": "Metrics disabled"})
|
||||
}
|
||||
|
||||
snapshots := metrics.MetricStats.GetSnapshots()
|
||||
|
||||
resp := make(map[string]interface{})
|
||||
|
@ -38,7 +38,7 @@ func readSettings() *MetricSettings {
|
||||
if graphitePublisher, err := CreateGraphitePublisher(); err != nil {
|
||||
log.Error(3, "Metrics: Failed to init Graphite metric publisher", err)
|
||||
} else if graphitePublisher != nil {
|
||||
log.Info("Metrics: Internal metrics publisher Graphite initialized")
|
||||
log.Info("Metrics: Graphite publisher initialized")
|
||||
settings.Publishers = append(settings.Publishers, graphitePublisher)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user