-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add kingfisher collect log warnings with scrapyloganalyzer #385
Open
yolile
wants to merge
1
commit into
main
Choose a base branch
from
29-kingfisher-collect-warnings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ gunicorn[setproctitle] | |
markdown-it-py | ||
psycopg2 | ||
requests | ||
scrapyloganalyzer | ||
sentry-sdk | ||
yapw[perf] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Log warnings don't generate emails and aren't saved (except temporarily in server log files).
If you want to generate emails, you need to use the
error
level.If you want to save the warnings, you need to update
self.job.context
.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.
Oh, nevermind, the cron job sets the log level to WARNING, so we will get emails.
Can you check whether
error_rate
can have a division by zero error when no items were scraped? Ideally with a test in scrapy-log-analyzer.Also, when the error_rate is non-zero, should the message be more detailed, e.g. print the error messages and/or error counts? https://kingfisher-collect.readthedocs.io/en/latest/logs.html#check-the-crawl-statistics
I think we should also check that
scrapy_log.is_finished() is True
. (This is different from the Scrapyd job being finished.) The log message can includelogparser["finish_reason"]
. https://kingfisher-collect.readthedocs.io/en/latest/logs.html#check-the-reason-for-closing-the-spiderIn open-contracting/scrapy-log-analyzer#11 we discussed storing
item_dropped_count
anditem_scraped_count
in the job context (easier to analyze multiple jobs without having to run logreport manually). If there are already other warnings, these can be logged as well.I think that's everything from open-contracting/scrapy-log-analyzer#11, but please have a look over again in case I missed an earlier idea.
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.
Hmm ok, I wasn't sure how much of what we discussed there we wanted to add to the Registry vs to a Kingfisher Collect command. But I guess is easier to have the full info in the Data Registry too
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.
Do you mean with outputs like these? If so, the error rate is 1 (I will push the test if that is what you meant)
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.
Aha, I guess there is always going to be at least one error.
Yeah, my thinking is it will be faster, operationally, to have the same info directly available in the Registry admin. Once the Collect command is implemented, we can see how to reduce any code duplication at that time.