switch to go-kit/log (#1575)
Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
parent
a80b7d0bc5
commit
2477c5c67d
158 changed files with 3434 additions and 4636 deletions
|
|
@ -18,9 +18,10 @@ package collector
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/mattn/go-xmlrpc"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ type supervisordCollector struct {
|
|||
stateDesc *prometheus.Desc
|
||||
exitStatusDesc *prometheus.Desc
|
||||
startTimeDesc *prometheus.Desc
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -40,7 +42,7 @@ func init() {
|
|||
}
|
||||
|
||||
// NewSupervisordCollector returns a new Collector exposing supervisord statistics.
|
||||
func NewSupervisordCollector() (Collector, error) {
|
||||
func NewSupervisordCollector(logger log.Logger) (Collector, error) {
|
||||
var (
|
||||
subsystem = "supervisord"
|
||||
labelNames = []string{"name", "group"}
|
||||
|
|
@ -70,6 +72,7 @@ func NewSupervisordCollector() (Collector, error) {
|
|||
labelNames,
|
||||
nil,
|
||||
),
|
||||
logger: logger,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +150,7 @@ func (c *supervisordCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
} else {
|
||||
ch <- prometheus.MustNewConstMetric(c.upDesc, prometheus.GaugeValue, 0, labels...)
|
||||
}
|
||||
log.Debugf("%s:%s is %s on pid %d", info.Group, info.Name, info.StateName, info.PID)
|
||||
level.Debug(c.logger).Log("msg", "process info", "group", info.Group, "name", info.Name, "state", info.StateName, "pid", info.PID)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue