use internal init for settings

This commit is contained in:
bergquist 2017-09-06 22:00:17 +02:00 committed by Carl Bergquist
parent dd9d4ecfbe
commit 6b1ae1a8a8
3 changed files with 9 additions and 10 deletions

View File

@ -54,8 +54,7 @@ func (g *GrafanaServerImpl) Start() {
g.writePIDFile()
initSql()
metricsCfg := metrics.ReadSettings(setting.Cfg)
metrics.Init(metricsCfg)
metrics.Init(setting.Cfg)
search.Init()
login.Init()
social.NewOAuthService()

View File

@ -360,12 +360,6 @@ func (b *Bridge) replaceCounterWithDelta(mf *dto.MetricFamily, metric model.Metr
}
return float64(value)
//println("use delta for", metric[model.MetricNameLabel], mf.GetType().String())
//TODO(bergquist): turn _count in summery into delta
//TODO(bergquist): turn _count in histogram into delta
}
func (b *Bridge) returnDelta(metric model.Metric, value model.SampleValue) float64 {

View File

@ -3,12 +3,13 @@ package metrics
import (
"context"
ini "gopkg.in/ini.v1"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/metrics/graphitebridge"
)
var metricsLogger log.Logger = log.New("metrics")
var metricPublishCounter int64 = 0
type logWrapper struct {
logger log.Logger
@ -18,7 +19,12 @@ func (lw *logWrapper) Println(v ...interface{}) {
lw.logger.Info("graphite metric bridge", v...)
}
func Init(settings *MetricSettings) {
func Init(file *ini.File) {
cfg := ReadSettings(file)
internalInit(cfg)
}
func internalInit(settings *MetricSettings) {
initMetricVars(settings)
if settings.GraphiteBridgeConfig != nil {