adjust logging

This commit is contained in:
Chris Lu 2020-09-20 15:38:59 -07:00
parent f498c71199
commit d013d09a9b
7 changed files with 11 additions and 17 deletions

View File

@ -153,10 +153,7 @@ func (s3opt *S3Options) startS3Server() bool {
} }
} }
glog.V(0).Infof("s3 server sends metrics to %s every %d seconds", metricsAddress, metricsIntervalSec) go stats_collect.LoopPushingMetric("s3", stats_collect.SourceName(uint32(*s3opt.port)), stats_collect.S3Gather, metricsAddress, metricsIntervalSec)
if metricsAddress != "" && metricsIntervalSec > 0 {
go stats_collect.LoopPushingMetric("s3", stats_collect.SourceName(uint32(*s3opt.port)), stats_collect.S3Gather, metricsAddress, metricsIntervalSec)
}
router := mux.NewRouter().SkipClean(true) router := mux.NewRouter().SkipClean(true)

View File

@ -64,7 +64,7 @@ func (iam *IdentityAccessManagement) loadS3ApiConfiguration(fileName string) err
return fmt.Errorf("fail to read %s : %v", fileName, readErr) return fmt.Errorf("fail to read %s : %v", fileName, readErr)
} }
glog.V(1).Infof("maybeLoadVolumeInfo Unmarshal volume info %v", fileName) glog.V(1).Infof("load s3 config: %v", fileName)
if err := jsonpb.Unmarshal(bytes.NewReader(rawData), s3ApiConfiguration); err != nil { if err := jsonpb.Unmarshal(bytes.NewReader(rawData), s3ApiConfiguration); err != nil {
glog.Warningf("unmarshal error: %v", err) glog.Warningf("unmarshal error: %v", err)
return fmt.Errorf("unmarshal %s error: %v", fileName, err) return fmt.Errorf("unmarshal %s error: %v", fileName, err)

View File

@ -45,8 +45,13 @@ func LoadClientTLS(config *viper.Viper, component string) grpc.DialOption {
return grpc.WithInsecure() return grpc.WithInsecure()
} }
certFileName, keyFileName := config.GetString(component+".cert"), config.GetString(component+".key")
if certFileName == "" || keyFileName == "" {
return grpc.WithInsecure()
}
// load cert/key, cacert // load cert/key, cacert
cert, err := tls.LoadX509KeyPair(config.GetString(component+".cert"), config.GetString(component+".key")) cert, err := tls.LoadX509KeyPair(certFileName, keyFileName)
if err != nil { if err != nil {
glog.V(1).Infof("load cert/key error: %v", err) glog.V(1).Infof("load cert/key error: %v", err)
return grpc.WithInsecure() return grpc.WithInsecure()

View File

@ -157,11 +157,6 @@ func (fs *FilerServer) maybeStartMetrics() {
} }
} }
glog.V(0).Infof("filer sends metrics to %s every %d seconds", fs.metricsAddress, fs.metricsIntervalSec)
if fs.metricsAddress == "" && fs.metricsIntervalSec <= 0 {
return
}
go stats.LoopPushingMetric("filer", stats.SourceName(fs.option.Port), stats.FilerGather, fs.metricsAddress, fs.metricsIntervalSec) go stats.LoopPushingMetric("filer", stats.SourceName(fs.option.Port), stats.FilerGather, fs.metricsAddress, fs.metricsIntervalSec)
} }

View File

@ -3,7 +3,6 @@ package weed_server
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/storage/backend" "github.com/chrislusf/seaweedfs/weed/storage/backend"
"github.com/chrislusf/raft" "github.com/chrislusf/raft"
@ -183,8 +182,6 @@ func (ms *MasterServer) LookupEcVolume(ctx context.Context, req *master_pb.Looku
func (ms *MasterServer) GetMasterConfiguration(ctx context.Context, req *master_pb.GetMasterConfigurationRequest) (*master_pb.GetMasterConfigurationResponse, error) { func (ms *MasterServer) GetMasterConfiguration(ctx context.Context, req *master_pb.GetMasterConfigurationRequest) (*master_pb.GetMasterConfigurationResponse, error) {
glog.V(0).Infof("master sends metrics to %s every %d seconds", ms.option.MetricsAddress, ms.option.MetricsIntervalSec)
resp := &master_pb.GetMasterConfigurationResponse{ resp := &master_pb.GetMasterConfigurationResponse{
MetricsAddress: ms.option.MetricsAddress, MetricsAddress: ms.option.MetricsAddress,
MetricsIntervalSeconds: uint32(ms.option.MetricsIntervalSec), MetricsIntervalSeconds: uint32(ms.option.MetricsIntervalSec),

View File

@ -97,9 +97,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
} }
go vs.heartbeat() go vs.heartbeat()
glog.V(0).Infof("volume server sends metrics to %s every %d seconds", vs.metricsAddress, vs.metricsIntervalSec) go stats.LoopPushingMetric("volumeServer", fmt.Sprintf("%s:%d", ip, port), stats.VolumeServerGather, vs.metricsAddress, vs.metricsIntervalSec)
hostAddress := fmt.Sprintf("%s:%d", ip, port)
go stats.LoopPushingMetric("volumeServer", hostAddress, stats.VolumeServerGather, vs.metricsAddress, vs.metricsIntervalSec)
return vs return vs
} }

View File

@ -133,6 +133,8 @@ func LoopPushingMetric(name, instance string, gatherer *prometheus.Registry, add
return return
} }
glog.V(0).Infof("%s server sends metrics to %s every %d seconds", name, addr, intervalSeconds)
pusher := push.New(addr, name).Gatherer(gatherer).Grouping("instance", instance) pusher := push.New(addr, name).Gatherer(gatherer).Grouping("instance", instance)
for { for {