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

Fixes #1252, Added Comments for Logger Discussion #1782

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

Metropass
Copy link
Contributor

@Metropass Metropass commented Feb 18, 2021

Issue This PR Addresses

Fixes #1252

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

So, I wanted to make this PR to discuss what needs to be changed for the Backend's logger.
I've done an audit and added comments to the code on what I personally think needs to be changed, and why.
I would really like some feedback/discussions so that what we change will be useful, and won't omit any data when debugging Telescope.

  • shutdown.js
    There seems to be a lot of error functions being invoked when the service is shutdown. We parse the error into the logger, and mention that the shutdown was not graceful & dirty. Is it possible to move this into debug?

  • processor.js
    -Inside, we have a lot of warnings being sent to the logger. I think that the info calls are appropriate, but should we change the warnings into debug, and return a generic message for production?

  • On Line 135, we send some data into info mentioning that a certain feed as been skipped. It might be redundant to print this all the time, as the larger the ignored feed list grows, the more messages this will output. Should we change this into debug?

  • Line 110, we only check for an instance of ArticleError, to let out service continue. Should we add a debug call to this, for developers to see what type of error is thrown?

These were the log calls that I think should be changed, I'm a little bit iffy on changing any calls within backend/web, as they're appropriate (in terms of logging any errors that occur).

I would love to get feedback on what needs to be changed.

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@HyperTHD
Copy link
Contributor

Move all your comments to the side instead of directly below the catch to avoid all these linting errors

@Metropass
Copy link
Contributor Author

Move all your comments to the side instead of directly below the catch to avoid all these linting errors

I'm aware there's some errors, I'm not trying to pass the tests atm until we figure out what to change

@yuanLeeMidori
Copy link
Contributor

@Metropass These are my thoughts,

  • showdown
    I agree it is not that necessary for error, maybe warn?
  • processor
    I'm not sure about this, the not-found or error log should be different from the general ones?
  • line 135
    I agree with you, skipping feeds might be more useful in debug level instead of info
  • line 110
    adding it to debug sounds good

I'm still looking for possibility if there is any error log can be moved to critical and warning. I'll append them in this PR if I have progress.

@@ -107,6 +107,7 @@ function articlesToPosts(articles, feed) {
articles.map(async (article) => {
try {
await Post.createFromArticle(article, feed);
//Add a debug log to see what is thrown?
Copy link
Contributor

Choose a reason for hiding this comment

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

We end up logging this in the caller on line 214, and that one could probably be turned into a warning vs. error.

@@ -132,10 +133,12 @@ module.exports = async function processor(job) {
let info;
const [invalid, delayed] = await Promise.all([feed.isInvalid(), feed.isDelayed()]);
if (invalid) {
//Debug?
logger.info(`Skipping resource at ${feed.url}. Feed previously marked invalid`);
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 info is right here, since we'd want to see skipped feeds in production.

logger.info(`Skipping resource at ${feed.url}. Feed previously marked invalid`);
return;
}
if (delayed) {
//Debug?
logger.info(`Skipping resource at ${feed.url}. Feed previously marked for delayed processing`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, leave this one info

@@ -144,6 +147,7 @@ module.exports = async function processor(job) {
// If we get no new version info, there's nothing left to do.
if (!info.shouldDownload) {
// Log some common cases we see, with a general message if none of these
//A lot of warnings & info, should we change it?
Copy link
Contributor

Choose a reason for hiding this comment

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

These are all useful for debugging, I'd leave them.

@@ -33,6 +33,7 @@ exports.start = async function () {
logger.info('Connected to elasticsearch!');

const concurrency = getFeedWorkersCount();
//Change into debug?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, debug, agree.

@@ -11,6 +11,7 @@ async function stopQueue() {
await feedQueue.close();
logger.info('Feed queue shut down.');
} catch (error) {
//Change to debug?
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, debug here.

@@ -24,6 +25,7 @@ async function stopWebServer() {
await serverClose();
logger.info('Web server shut down.');
} catch (error) {
// Change to debug?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, debug for sure.

@@ -33,6 +35,7 @@ async function cleanShutdown() {
await Promise.all([stopQueue(), stopWebServer()]);
logger.info('Completing shut down.');
} catch (error) {
//Change to debug? Shutsdown, but dirty
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, debug.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

You've got both branches in here, please separate this work from the other.

package.json Outdated
@@ -82,6 +82,7 @@
"body-parser": "1.19.0",
"bull": "3.20.1",
"bull-board": "1.3.1",
"clean-whitespace": "0.1.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of this? Ah, from the merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it's cleaned out now :)

chrispinkney
chrispinkney previously approved these changes Feb 19, 2021
Copy link
Contributor

@chrispinkney chrispinkney left a comment

Choose a reason for hiding this comment

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

Lookin' good!

humphd
humphd previously approved these changes Feb 19, 2021
@humphd humphd added this to the 1.7 Release milestone Feb 19, 2021
@Metropass Metropass merged commit 1210a60 into Seneca-CDOT:master Feb 19, 2021
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.

Reduce log spam
8 participants