diff --git a/builder/exector/monitor.go b/builder/monitor/monitor.go similarity index 93% rename from builder/exector/monitor.go rename to builder/monitor/monitor.go index 451697f2f..eaf9e9b77 100644 --- a/builder/exector/monitor.go +++ b/builder/monitor/monitor.go @@ -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) } diff --git a/cmd/builder/server/server.go b/cmd/builder/server/server.go index 8b00f66e6..f55b3d9ea 100644 --- a/cmd/builder/server/server.go +++ b/cmd/builder/server/server.go @@ -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())