Reduce noise in logging (#733)
This commit is contained in:
parent
2a0c4e60d2
commit
9ac3517432
@ -81,7 +81,6 @@ func (t *tally) identifyActiveNodes(ctx context.Context) (err error) {
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
|
||||
t.logger.Debug("entering pointerdb iterate")
|
||||
err = t.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true},
|
||||
func(it storage.Iterator) error {
|
||||
var item storage.ListItem
|
||||
|
@ -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
|
||||
func (c *checker) identifyInjuredSegments(ctx context.Context) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
c.logger.Debug("entering pointerdb iterate")
|
||||
|
||||
err = c.pointerdb.Iterate(ctx, &pb.IterateRequest{Recurse: true},
|
||||
func(it storage.Iterator) error {
|
||||
|
@ -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) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
s.logger.Debug("entering pointerdb get")
|
||||
|
||||
if err = s.validateAuth(ctx); err != nil {
|
||||
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
|
||||
func (s *Server) Delete(ctx context.Context, req *pb.DeleteRequest) (resp *pb.DeleteResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering pointerdb delete")
|
||||
|
||||
if err = s.validateAuth(ctx); err != nil {
|
||||
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))
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
s.logger.Debug("deleted pointer at path: " + req.GetPath())
|
||||
|
||||
return &pb.DeleteResponse{}, nil
|
||||
}
|
||||
|
||||
|
@ -157,8 +157,6 @@ func cleanup(cmd *cobra.Command) {
|
||||
defer zap.ReplaceGlobals(logger)()
|
||||
defer zap.RedirectStdLog(logger)()
|
||||
|
||||
logger.Debug("logging initialized")
|
||||
|
||||
// okay now that logging is working, inform about the broken keys
|
||||
for _, key := range brokenKeys {
|
||||
logger.Sugar().Infof("Invalid configuration file key: %s", key)
|
||||
|
@ -30,13 +30,13 @@ var (
|
||||
|
||||
// Server implements the statdb RPC service
|
||||
type Server struct {
|
||||
log *zap.Logger
|
||||
DB *dbx.DB
|
||||
logger *zap.Logger
|
||||
apiKey []byte
|
||||
}
|
||||
|
||||
// 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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -49,7 +49,7 @@ func NewServer(driver, source, apiKey string, logger *zap.Logger) (*Server, erro
|
||||
|
||||
return &Server{
|
||||
DB: db,
|
||||
logger: logger,
|
||||
log: log,
|
||||
apiKey: []byte(apiKey),
|
||||
}, nil
|
||||
}
|
||||
@ -65,7 +65,6 @@ func (s *Server) validateAuth(ctx context.Context) error {
|
||||
// Create a db entry for the provided storagenode
|
||||
func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp *pb.CreateResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb Create")
|
||||
|
||||
if err := s.validateAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
@ -112,7 +111,6 @@ func (s *Server) Create(ctx context.Context, createReq *pb.CreateRequest) (resp
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, err.Error())
|
||||
}
|
||||
s.logger.Debug("created in the db: " + node.Id.String())
|
||||
|
||||
nodeStats := &pb.NodeStats{
|
||||
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
|
||||
func (s *Server) Get(ctx context.Context, getReq *pb.GetRequest) (resp *pb.GetResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb Get")
|
||||
|
||||
err = s.validateAuth(ctx)
|
||||
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
|
||||
func (s *Server) FindValidNodes(ctx context.Context, getReq *pb.FindValidNodesRequest) (resp *pb.FindValidNodesResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb FindValidNodes")
|
||||
|
||||
var passedIds storj.NodeIDList
|
||||
|
||||
@ -171,7 +167,7 @@ func (s *Server) FindValidNodes(ctx context.Context, getReq *pb.FindValidNodesRe
|
||||
defer func() {
|
||||
err = rows.Close()
|
||||
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
|
||||
func (s *Server) Update(ctx context.Context, updateReq *pb.UpdateRequest) (resp *pb.UpdateResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb Update")
|
||||
|
||||
err = s.validateAuth(ctx)
|
||||
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
|
||||
func (s *Server) UpdateUptime(ctx context.Context, updateReq *pb.UpdateUptimeRequest) (resp *pb.UpdateUptimeResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb UpdateUptime")
|
||||
|
||||
err = s.validateAuth(ctx)
|
||||
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
|
||||
func (s *Server) UpdateAuditSuccess(ctx context.Context, updateReq *pb.UpdateAuditSuccessRequest) (resp *pb.UpdateAuditSuccessResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb UpdateAuditSuccess")
|
||||
|
||||
err = s.validateAuth(ctx)
|
||||
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
|
||||
func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatchRequest) (resp *pb.UpdateBatchResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb UpdateBatch")
|
||||
|
||||
var nodeStatsList []*pb.NodeStats
|
||||
var failedNodes []*pb.Node
|
||||
@ -396,7 +388,7 @@ func (s *Server) UpdateBatch(ctx context.Context, updateBatchReq *pb.UpdateBatch
|
||||
|
||||
updateRes, err := s.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
s.logger.Error(err.Error())
|
||||
s.log.Error(err.Error())
|
||||
failedNodes = append(failedNodes, node)
|
||||
} else {
|
||||
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
|
||||
func (s *Server) CreateEntryIfNotExists(ctx context.Context, createIfReq *pb.CreateEntryIfNotExistsRequest) (resp *pb.CreateEntryIfNotExistsResponse, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
s.logger.Debug("entering statdb CreateEntryIfNotExists")
|
||||
|
||||
getReq := &pb.GetRequest{
|
||||
NodeId: createIfReq.Node.Id,
|
||||
|
Loading…
Reference in New Issue
Block a user