-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up logging #5582
Clean up logging #5582
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,8 @@ func (f *Fetch) getHashes( | |
|
||
var eg errgroup.Group | ||
var failed atomic.Uint64 | ||
f.logger.WithContext(ctx).With().Info("attempting to fetch hash objects", | ||
log.Uint64("count", uint64(len(hashes)))) | ||
for i, hash := range hashes { | ||
if err := options.limiter.Acquire(ctx, 1); err != nil { | ||
pendingMetric.Add(float64(i - len(hashes))) | ||
|
@@ -97,7 +99,7 @@ func (f *Fetch) getHashes( | |
options.limiter.Release(1) | ||
pendingMetric.Add(-1) | ||
if p.err != nil { | ||
f.logger.Debug("failed to get hash", | ||
f.logger.WithContext(ctx).With().Debug("failed to get hash", | ||
log.String("hint", string(hint)), | ||
log.Stringer("hash", h), | ||
log.Err(p.err), | ||
|
@@ -110,6 +112,7 @@ func (f *Fetch) getHashes( | |
} | ||
|
||
eg.Wait() | ||
f.logger.WithContext(ctx).With().Info("finished fetching hash objects") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this it debug |
||
if failed.Load() > 0 { | ||
return fmt.Errorf("failed to fetch %d hashes out of %d", failed.Load(), len(hashes)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,7 +387,7 @@ func (pb *ProposalBuilder) decideMeshHash(ctx context.Context, current types.Lay | |
} | ||
|
||
func (pb *ProposalBuilder) UpdateActiveSet(epoch types.EpochID, activeSet []types.ATXID) { | ||
pb.logger.With().Info("received activeset update", | ||
pb.logger.With().Debug("received activeset update", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That one IMO is Info because it's the centralized update. |
||
epoch, | ||
log.Int("size", len(activeSet)), | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -559,7 +559,7 @@ | |
return logger.WithName(name) | ||
} | ||
|
||
func (app *App) getLevel(name string) log.Level { | ||
alvl, exist := app.loggers[name] | ||
if !exist { | ||
return 0 | ||
|
@@ -1856,8 +1856,10 @@ | |
cfg := app.Config.P2P | ||
cfg.DataDir = filepath.Join(app.Config.DataDir(), "p2p") | ||
p2plog := app.addLogger(P2PLogger, lg) | ||
// if addLogger won't add a level we will use a default 0 (info). | ||
cfg.LogLevel = app.getLevel(P2PLogger) | ||
|
||
// our p2p code logs at the default level (Info), but we want the lower level libp2p logging | ||
// to be less verbose | ||
cfg.LogLevel = zapcore.WarnLevel | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's configurable; why not change the default config instead? Sometimes we really need to set it. |
||
prologue := fmt.Sprintf("%x-%v", | ||
app.Config.Genesis.GenesisID(), | ||
types.GetEffectiveGenesis(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,7 +409,7 @@ | |
return nil | ||
} | ||
natEv := ev.(event.EvtNATDeviceTypeChanged) | ||
fh.logger.With().Info("NAT type changed", | ||
fh.logger.With().Debug("NAT type changed", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be hard to detect what's wrong when we hide it with Debug. |
||
log.Stringer("transportProtocol", natEv.TransportProtocol), | ||
log.Stringer("type", natEv.NatDeviceType)) | ||
fh.natType.Lock() | ||
|
@@ -425,7 +425,7 @@ | |
return nil | ||
} | ||
reachEv := ev.(event.EvtLocalReachabilityChanged) | ||
fh.logger.With().Info("local reachability changed", | ||
fh.logger.With().Debug("local reachability changed", | ||
log.Stringer("reachability", reachEv.Reachability)) | ||
fh.reachability.Lock() | ||
fh.reachability.value = reachEv.Reachability | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,7 +310,7 @@ | |
return fmt.Errorf("get epoch info (peer %v): %w", peer, err) | ||
} | ||
if len(ed.AtxIDs) == 0 { | ||
d.logger.WithContext(ctx).With().Debug("peer have zero atx", | ||
d.logger.WithContext(ctx).With().Debug("peer has no atx data", | ||
epoch, | ||
log.Stringer("peer", peer), | ||
) | ||
|
@@ -326,6 +326,12 @@ | |
log.Int("missing", len(missing)), | ||
) | ||
if len(missing) > 0 { | ||
d.logger.WithContext(ctx).With().Info("fetching missing epoch atxs", | ||
epoch, | ||
log.Stringer("peer", peer), | ||
log.Int("total", len(ed.AtxIDs)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. afaik, this total is not the absolute total, so we need to be careful here. maybe @dshulyak can point to more, but I remember that I had a similar idea some time ago, and that's how I remembered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this is from epoch info response, so in this case this is how many atxs are available from that peer. definitely not absolute, and not even how many are available locally
|
||
log.Int("missing", len(missing)), | ||
) | ||
if err := d.fetcher.GetAtxs(ctx, missing); err != nil { | ||
return fmt.Errorf("get ATXs: %w", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO debug too.