Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Clean up logging #5582

wants to merge 5 commits into from

Conversation

lrettig
Copy link
Member

@lrettig lrettig commented Feb 18, 2024

Motivation

A developer should be able to tell what's going on by following the node log. This cleans up a lot of the noise in the logs and highlights important information such as sync status. No log lines are removed, but verbosity is decreased (e.g., warn -> info, info -> debug). libp2p logs in particular are moved to warn level.

Test Plan

N/A, no logic changes

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

Reduce the default log level to something manageable for a normal user,
so that they have a sense of what's actually going on

Reduce libp2p log level
@@ -110,6 +112,7 @@ func (f *Fetch) getHashes(
}

eg.Wait()
f.logger.WithContext(ctx).With().Info("finished fetching hash objects")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this it debug

@@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO debug too.

@@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one IMO is Info because it's the centralized update.


// 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
Copy link
Member

Choose a reason for hiding this comment

The 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.

@@ -409,7 +409,7 @@ func (fh *Host) trackNetEvents() error {
return nil
}
natEv := ev.(event.EvtNATDeviceTypeChanged)
fh.logger.With().Info("NAT type changed",
fh.logger.With().Debug("NAT type changed",
Copy link
Member

Choose a reason for hiding this comment

The 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.

d.logger.WithContext(ctx).With().Info("fetching missing epoch atxs",
epoch,
log.Stringer("peer", peer),
log.Int("total", len(ed.AtxIDs)),
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

ed, err := d.fetcher.PeerEpochInfo(ctx, peer, epoch)

Copy link

codecov bot commented Feb 18, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (0c4c55d) 79.6% compared to head (f10f46b) 79.7%.

Files Patch % Lines
activation/handler.go 25.0% 3 Missing ⚠️
p2p/upgrade.go 0.0% 2 Missing ⚠️
p2p/dhtdiscovery/discovery.go 66.6% 1 Missing ⚠️
proposals/handler.go 0.0% 1 Missing ⚠️
syncer/data_fetch.go 85.7% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #5582   +/-   ##
=======================================
  Coverage     79.6%   79.7%           
=======================================
  Files          270     270           
  Lines        27186   27203   +17     
=======================================
+ Hits         21667   21684   +17     
+ Misses        3973    3972    -1     
- Partials      1546    1547    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lrettig
Copy link
Member Author

lrettig commented May 21, 2024

this is stale by now, closing and will revisit these later if needed.

@lrettig lrettig closed this May 21, 2024
@fasmat fasmat deleted the sync-log-cleanup branch May 21, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants