Reduce noise in logging (#733)

This commit is contained in:
Egon Elbre 2018-11-29 22:59:26 +02:00 committed by GitHub
parent 2a0c4e60d2
commit 9ac3517432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 22 deletions

View File

@ -81,7 +81,6 @@ func (t *tally) identifyActiveNodes(ctx context.Context) (err error) {
return Error.Wrap(err) return Error.Wrap(err)
} }
t.logger.Debug("entering pointerdb iterate")
err = t.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true}, err = t.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true},
func(it storage.Iterator) error { func(it storage.Iterator) error {
var item storage.ListItem var item storage.ListItem

View File

@ -65,7 +65,6 @@ func (c *checker) Run(ctx context.Context) (err error) {
// identifyInjuredSegments checks for missing pieces off of the pointerdb and overlay cache // identifyInjuredSegments checks for missing pieces off of the pointerdb and overlay cache
func (c *checker) identifyInjuredSegments(ctx context.Context) (err error) { func (c *checker) identifyInjuredSegments(ctx context.Context) (err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
c.logger.Debug("entering pointerdb iterate")
err = c.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true}, err = c.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true},
func(it storage.Iterator) error { func(it storage.Iterator) error {

View File

@ -114,8 +114,6 @@ func (s *Server) Put(ctx context.Context, req *pb.PutRequest) (resp *pb.PutRespo
func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (resp *pb.GetResponse, err error) { func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (resp *pb.GetResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering pointerdb get")
if err = s.validateAuth(ctx); err != nil { if err = s.validateAuth(ctx); err != nil {
return nil, err return nil, err
} }
@ -268,7 +266,6 @@ func (s *Server) setMetadata(item *pb.ListResponse_Item, data []byte, metaFlags
// Delete formats and hands off a file path to delete from boltdb // Delete formats and hands off a file path to delete from boltdb
func (s *Server) Delete(ctx context.Context, req *pb.DeleteRequest) (resp *pb.DeleteResponse, err error) { func (s *Server) Delete(ctx context.Context, req *pb.DeleteRequest) (resp *pb.DeleteResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering pointerdb delete")
if err = s.validateAuth(ctx); err != nil { if err = s.validateAuth(ctx); err != nil {
return nil, err return nil, err
@ -279,7 +276,7 @@ func (s *Server) Delete(ctx context.Context, req *pb.DeleteRequest) (resp *pb.De
s.logger.Error("err deleting path and pointer", zap.Error(err)) s.logger.Error("err deleting path and pointer", zap.Error(err))
return nil, status.Errorf(codes.Internal, err.Error()) return nil, status.Errorf(codes.Internal, err.Error())
} }
s.logger.Debug("deleted pointer at path: " + req.GetPath())
return &pb.DeleteResponse{}, nil return &pb.DeleteResponse{}, nil
} }

View File

@ -157,8 +157,6 @@ func cleanup(cmd *cobra.Command) {
defer zap.ReplaceGlobals(logger)() defer zap.ReplaceGlobals(logger)()
defer zap.RedirectStdLog(logger)() defer zap.RedirectStdLog(logger)()
logger.Debug("logging initialized")
// okay now that logging is working, inform about the broken keys // okay now that logging is working, inform about the broken keys
for _, key := range brokenKeys { for _, key := range brokenKeys {
logger.Sugar().Infof("Invalid configuration file key: %s", key) logger.Sugar().Infof("Invalid configuration file key: %s", key)

View File

@ -30,13 +30,13 @@ var (
// Server implements the statdb RPC service // Server implements the statdb RPC service
type Server struct { type Server struct {
log *zap.Logger
DB *dbx.DB DB *dbx.DB
logger *zap.Logger
apiKey []byte apiKey []byte
} }
// NewServer creates instance of Server // NewServer creates instance of Server
func NewServer(driver, source, apiKey string, logger *zap.Logger) (*Server, error) { func NewServer(driver, source, apiKey string, log *zap.Logger) (*Server, error) {
db, err := dbx.Open(driver, source) db, err := dbx.Open(driver, source)
if err != nil { if err != nil {
return nil, err return nil, err
@ -49,7 +49,7 @@ func NewServer(driver, source, apiKey string, logger *zap.Logger) (*Server, erro
return &Server{ return &Server{
DB: db, DB: db,
logger: logger, log: log,
apiKey: []byte(apiKey), apiKey: []byte(apiKey),
}, nil }, nil
} }
@ -65,7 +65,6 @@ func (s *Server) validateAuth(ctx context.Context) error {
// Create a db entry for the provided storagenode // Create a db entry for the provided storagenode
func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp *pb.CreateResponse, err error) { func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp *pb.CreateResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb Create")
if err := s.validateAuth(ctx); err != nil { if err := s.validateAuth(ctx); err != nil {
return nil, err return nil, err
@ -112,7 +111,6 @@ func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, err.Error()) return nil, status.Errorf(codes.Internal, err.Error())
} }
s.logger.Debug("created in the db: " + node.Id.String())
nodeStats := &pb.NodeStats{ nodeStats := &pb.NodeStats{
NodeId: node.Id, NodeId: node.Id,
@ -128,7 +126,6 @@ func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp
// Get a storagenode's stats from the db // Get a storagenode's stats from the db
func (s *Server) Get(ctx context.Context, getReq *pb.GetRequest) (resp *pb.GetResponse, err error) { func (s *Server) Get(ctx context.Context, getReq *pb.GetRequest) (resp *pb.GetResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb Get")
err = s.validateAuth(ctx) err = s.validateAuth(ctx)
if err != nil { if err != nil {
@ -154,7 +151,6 @@ func (s *Server) Get(ctx context.Context, getReq *pb.GetRequest) (resp *pb.GetRe
// FindValidNodes finds a subset of storagenodes that meet reputation requirements // FindValidNodes finds a subset of storagenodes that meet reputation requirements
func (s *Server) FindValidNodes(ctx context.Context, getReq *pb.FindValidNodesRequest) (resp *pb.FindValidNodesResponse, err error) { func (s *Server) FindValidNodes(ctx context.Context, getReq *pb.FindValidNodesRequest) (resp *pb.FindValidNodesResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb FindValidNodes")
var passedIds storj.NodeIDList var passedIds storj.NodeIDList
@ -171,7 +167,7 @@ func (s *Server) FindValidNodes(ctx context.Context, getReq *pb.FindValidNodesRe
defer func() { defer func() {
err = rows.Close() err = rows.Close()
if err != nil { if err != nil {
s.logger.Error(err.Error()) s.log.Error(err.Error())
} }
}() }()
@ -214,7 +210,6 @@ func (s *Server) findValidNodesQuery(nodeIds storj.NodeIDList, auditCount int64,
// Update a single storagenode's stats in the db // Update a single storagenode's stats in the db
func (s *Server) Update(ctx context.Context, updateReq *pb.UpdateRequest) (resp *pb.UpdateResponse, err error) { func (s *Server) Update(ctx context.Context, updateReq *pb.UpdateRequest) (resp *pb.UpdateResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb Update")
err = s.validateAuth(ctx) err = s.validateAuth(ctx)
if err != nil { if err != nil {
@ -287,7 +282,6 @@ func (s *Server) Update(ctx context.Context, updateReq *pb.UpdateRequest) (resp
// UpdateUptime updates a single storagenode's uptime stats in the db // UpdateUptime updates a single storagenode's uptime stats in the db
func (s *Server) UpdateUptime(ctx context.Context, updateReq *pb.UpdateUptimeRequest) (resp *pb.UpdateUptimeResponse, err error) { func (s *Server) UpdateUptime(ctx context.Context, updateReq *pb.UpdateUptimeRequest) (resp *pb.UpdateUptimeResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb UpdateUptime")
err = s.validateAuth(ctx) err = s.validateAuth(ctx)
if err != nil { if err != nil {
@ -336,7 +330,6 @@ func (s *Server) UpdateUptime(ctx context.Context, updateReq *pb.UpdateUptimeReq
// UpdateAuditSuccess updates a single storagenode's uptime stats in the db // UpdateAuditSuccess updates a single storagenode's uptime stats in the db
func (s *Server) UpdateAuditSuccess(ctx context.Context, updateReq *pb.UpdateAuditSuccessRequest) (resp *pb.UpdateAuditSuccessResponse, err error) { func (s *Server) UpdateAuditSuccess(ctx context.Context, updateReq *pb.UpdateAuditSuccessRequest) (resp *pb.UpdateAuditSuccessResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb UpdateAuditSuccess")
err = s.validateAuth(ctx) err = s.validateAuth(ctx)
if err != nil { if err != nil {
@ -385,7 +378,6 @@ func (s *Server) UpdateAuditSuccess(ctx context.Context, updateReq *pb.UpdateAud
// UpdateBatch for updating multiple farmers' stats in the db // UpdateBatch for updating multiple farmers' stats in the db
func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatchRequest) (resp *pb.UpdateBatchResponse, err error) { func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatchRequest) (resp *pb.UpdateBatchResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb UpdateBatch")
var nodeStatsList []*pb.NodeStats var nodeStatsList []*pb.NodeStats
var failedNodes []*pb.Node var failedNodes []*pb.Node
@ -396,7 +388,7 @@ func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatch
updateRes, err := s.Update(ctx, updateReq) updateRes, err := s.Update(ctx, updateReq)
if err != nil { if err != nil {
s.logger.Error(err.Error()) s.log.Error(err.Error())
failedNodes = append(failedNodes, node) failedNodes = append(failedNodes, node)
} else { } else {
nodeStatsList = append(nodeStatsList, updateRes.Stats) nodeStatsList = append(nodeStatsList, updateRes.Stats)
@ -413,7 +405,6 @@ func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatch
// CreateEntryIfNotExists creates a statdb node entry and saves to statdb if it didn't already exist // CreateEntryIfNotExists creates a statdb node entry and saves to statdb if it didn't already exist
func (s *Server) CreateEntryIfNotExists(ctx context.Context, createIfReq *pb.CreateEntryIfNotExistsRequest) (resp *pb.CreateEntryIfNotExistsResponse, err error) { func (s *Server) CreateEntryIfNotExists(ctx context.Context, createIfReq *pb.CreateEntryIfNotExistsRequest) (resp *pb.CreateEntryIfNotExistsResponse, err error) {
defer mon.Task()(&ctx)(&err) defer mon.Task()(&ctx)(&err)
s.logger.Debug("entering statdb CreateEntryIfNotExists")
getReq := &pb.GetRequest{ getReq := &pb.GetRequest{
NodeId: createIfReq.Node.Id, NodeId: createIfReq.Node.Id,