[FIX] fix bug

This commit is contained in:
zhoujunhao 2018-07-11 16:16:35 +08:00
parent 47a8174284
commit cf621c74c0
2 changed files with 6 additions and 4 deletions

View File

@ -1,8 +1,9 @@
package exector
package monitor
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/goodrain/rainbond/builder/discover"
"github.com/goodrain/rainbond/builder/exector"
)
// Metric name parts.
@ -78,6 +79,6 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
}
ch <- prometheus.MustNewConstMetric(e.healthStatus.Desc(), prometheus.GaugeValue, val)
ch <- prometheus.MustNewConstMetric(e.taskNum.Desc(), prometheus.GaugeValue, TaskNum)
ch <- prometheus.MustNewConstMetric(e.taskError.Desc(), prometheus.GaugeValue, ErrorNum)
ch <- prometheus.MustNewConstMetric(e.taskNum.Desc(), prometheus.GaugeValue, exector.TaskNum)
ch <- prometheus.MustNewConstMetric(e.taskError.Desc(), prometheus.GaugeValue, exector.ErrorNum)
}

View File

@ -25,6 +25,7 @@ import (
"github.com/goodrain/rainbond/builder/discover"
"github.com/goodrain/rainbond/builder/exector"
"github.com/goodrain/rainbond/builder/monitor"
"github.com/goodrain/rainbond/cmd/builder/option"
"github.com/goodrain/rainbond/db"
"github.com/goodrain/rainbond/db/config"
@ -82,7 +83,7 @@ func Run(s *option.Builder) error {
}
defer cle.Stop()
exporter := exector.NewExporter()
exporter := monitor.NewExporter()
prometheus.MustRegister(exporter)
r := api.APIServer()
r.Handle(s.Config.PrometheusMetricPath, promhttp.Handler())