From fb8340acb2eaca5c361e54333ca17d854b38eef0 Mon Sep 17 00:00:00 2001 From: frrist Date: Thu, 27 Aug 2020 11:42:57 -0700 Subject: [PATCH] polish(chainwatch): clean up logging --- cmd/lotus-chainwatch/processor/messages.go | 13 ------------- cmd/lotus-chainwatch/processor/mpool.go | 2 -- cmd/lotus-chainwatch/processor/processor.go | 8 +------- .../scheduler/refresh_top_miners_by_base_reward.go | 7 ------- 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/cmd/lotus-chainwatch/processor/messages.go b/cmd/lotus-chainwatch/processor/messages.go index 2e88d8aae..e3d23f219 100644 --- a/cmd/lotus-chainwatch/processor/messages.go +++ b/cmd/lotus-chainwatch/processor/messages.go @@ -3,7 +3,6 @@ package processor import ( "context" "sync" - "time" "golang.org/x/sync/errgroup" "golang.org/x/xerrors" @@ -120,10 +119,6 @@ func (p *Processor) persistMessagesAndReceipts(ctx context.Context, blocks map[c } func (p *Processor) storeReceipts(recs map[mrec]*types.MessageReceipt) error { - start := time.Now() - defer func() { - log.Debugw("Persisted Receipts", "duration", time.Since(start).String()) - }() tx, err := p.db.Begin() if err != nil { return err @@ -164,10 +159,6 @@ create temp table recs (like receipts excluding constraints) on commit drop; } func (p *Processor) storeMsgInclusions(incls map[cid.Cid][]cid.Cid) error { - start := time.Now() - defer func() { - log.Debugw("Persisted Message Inclusions", "duration", time.Since(start).String()) - }() tx, err := p.db.Begin() if err != nil { return err @@ -206,10 +197,6 @@ create temp table mi (like block_messages excluding constraints) on commit drop; } func (p *Processor) storeMessages(msgs map[cid.Cid]*types.Message) error { - start := time.Now() - defer func() { - log.Debugw("Persisted Messages", "duration", time.Since(start).String()) - }() tx, err := p.db.Begin() if err != nil { return err diff --git a/cmd/lotus-chainwatch/processor/mpool.go b/cmd/lotus-chainwatch/processor/mpool.go index 1f5826170..0a6445d78 100644 --- a/cmd/lotus-chainwatch/processor/mpool.go +++ b/cmd/lotus-chainwatch/processor/mpool.go @@ -47,8 +47,6 @@ func (p *Processor) subMpool(ctx context.Context) { msgs[v.Message.Message.Cid()] = &v.Message.Message } - log.Debugf("Processing %d mpool updates", len(msgs)) - err := p.storeMessages(msgs) if err != nil { log.Error(err) diff --git a/cmd/lotus-chainwatch/processor/processor.go b/cmd/lotus-chainwatch/processor/processor.go index 9b12a2cf7..15ecf532d 100644 --- a/cmd/lotus-chainwatch/processor/processor.go +++ b/cmd/lotus-chainwatch/processor/processor.go @@ -152,7 +152,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle market changes: %w", err) return } - log.Info("Processed Market Changes") }() grp.Add(1) @@ -162,7 +161,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle miner changes: %w", err) return } - log.Info("Processed Miner Changes") }() grp.Add(1) @@ -172,7 +170,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle reward changes: %w", err) return } - log.Info("Processed Reward Changes") }() grp.Add(1) @@ -182,7 +179,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle power actor changes: %w", err) return } - log.Info("Processes Power Changes") }() grp.Add(1) @@ -192,7 +188,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle message changes: %w", err) return } - log.Info("Processed Message Changes") }() grp.Add(1) @@ -202,7 +197,6 @@ func (p *Processor) Start(ctx context.Context) { log.Errorf("Failed to handle common actor changes: %w", err) return } - log.Info("Processed CommonActor Changes") }() grp.Wait() @@ -214,7 +208,7 @@ func (p *Processor) Start(ctx context.Context) { if err := p.refreshViews(); err != nil { log.Errorw("Failed to refresh views", "error", err) } - log.Infow("Processed Batch", "duration", time.Since(loopStart).String()) + log.Infow("Processed Batch Complete", "duration", time.Since(loopStart).String()) } } }() diff --git a/cmd/lotus-chainwatch/scheduler/refresh_top_miners_by_base_reward.go b/cmd/lotus-chainwatch/scheduler/refresh_top_miners_by_base_reward.go index b6a24507f..93d546a54 100644 --- a/cmd/lotus-chainwatch/scheduler/refresh_top_miners_by_base_reward.go +++ b/cmd/lotus-chainwatch/scheduler/refresh_top_miners_by_base_reward.go @@ -3,8 +3,6 @@ package scheduler import ( "context" "database/sql" - "time" - "golang.org/x/xerrors" ) @@ -65,11 +63,6 @@ func refreshTopMinerByBaseReward(ctx context.Context, db *sql.DB) error { default: } - t := time.Now() - defer func() { - log.Debugw("refresh top_miners_by_base_reward", "duration", time.Since(t).String()) - }() - _, err := db.Exec("refresh materialized view top_miners_by_base_reward;") if err != nil { return xerrors.Errorf("refresh top_miners_by_base_reward: %w", err)