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

Add Logger #10

Merged
merged 4 commits into from
May 30, 2024
Merged

Add Logger #10

merged 4 commits into from
May 30, 2024

Conversation

bh2smith
Copy link
Collaborator

This PR is split into two commits:

  1. Another version bump of near-lake-frame with improvements related to logging. Specifically this PR which also migrated the fetch_latest_block function from here to there.
  2. Adding a logger and replacing all print statements with log statements. Note that we explicitly filter out the noisy "missing shard" log (this is only temporary because I think the missing shard log should be debug instead of warning).

@bh2smith bh2smith requested a review from anthony-near May 30, 2024 08:43
logger.py Outdated Show resolved Hide resolved
def set_logger(name: str) -> logging.Logger:
logging.basicConfig(level=logging.INFO)
logging.getLogger("near_lake_framework").setLevel(logging.INFO)
missing_shard_filter = IgnoreFilter("doesn't exist")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the missing shard data something that gets backfilled in future data from near lake or skipped?

Copy link
Collaborator Author

@bh2smith bh2smith May 30, 2024

Choose a reason for hiding this comment

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

My understanding is that there was no data on the shared corresponding to the block. I think this filter can be removed if we downgrade this log to debug and set the lake log level to info. The filter is only a temporary solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created a PR here: frolvanya/near-lake-framework-py#16

We can leave this open and wait for the next version bump (if its approved) - then remove the whole filter class.

Copy link
Collaborator

@anthony-near anthony-near left a comment

Choose a reason for hiding this comment

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

Once the linter is happy https://github.com/near/gas-station-event-indexer/actions/runs/9305341947/job/25612033263, then we can merge. Seems like the best long term solution is improvements on the near-lake-framework-py repo.

@bh2smith
Copy link
Collaborator Author

Linter is happy, I made an issue (#11) related to removal of log filter and hopefully be back soon to do the log configuration more properly (#12).

@bh2smith bh2smith merged commit cfa0324 into main May 30, 2024
1 check passed
@bh2smith bh2smith deleted the add-logger branch May 30, 2024 16: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.

2 participants