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
|
|
@ -20,8 +20,9 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
"github.com/go-kit/kit/log/level"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/prometheus/procfs"
|
||||
)
|
||||
|
||||
|
|
@ -30,8 +31,9 @@ const (
|
|||
)
|
||||
|
||||
type buddyinfoCollector struct {
|
||||
fs procfs.FS
|
||||
desc *prometheus.Desc
|
||||
fs procfs.FS
|
||||
desc *prometheus.Desc
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
@ -39,7 +41,7 @@ func init() {
|
|||
}
|
||||
|
||||
// NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats.
|
||||
func NewBuddyinfoCollector() (Collector, error) {
|
||||
func NewBuddyinfoCollector(logger log.Logger) (Collector, error) {
|
||||
desc := prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, buddyInfoSubsystem, "blocks"),
|
||||
"Count of free blocks according to size.",
|
||||
|
|
@ -49,7 +51,7 @@ func NewBuddyinfoCollector() (Collector, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open procfs: %w", err)
|
||||
}
|
||||
return &buddyinfoCollector{fs, desc}, nil
|
||||
return &buddyinfoCollector{fs, desc, logger}, nil
|
||||
}
|
||||
|
||||
// Update calls (*buddyinfoCollector).getBuddyInfo to get the platform specific
|
||||
|
|
@ -60,7 +62,7 @@ func (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
return fmt.Errorf("couldn't get buddyinfo: %s", err)
|
||||
}
|
||||
|
||||
log.Debugf("Set node_buddy: %#v", buddyInfo)
|
||||
level.Debug(c.logger).Log("msg", "Set node_buddy", "buddyInfo", buddyInfo)
|
||||
for _, entry := range buddyInfo {
|
||||
for size, value := range entry.Sizes {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue