-
Notifications
You must be signed in to change notification settings - Fork 189
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
Conversation
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 |
@Metropass These are my thoughts,
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. |
src/backend/feed/processor.js
Outdated
@@ -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? |
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.
We end up logging this in the caller on line 214, and that one could probably be turned into a warning vs. error.
src/backend/feed/processor.js
Outdated
@@ -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`); |
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.
I think info is right here, since we'd want to see skipped feeds in production.
src/backend/feed/processor.js
Outdated
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`); |
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.
Same, leave this one info
src/backend/feed/processor.js
Outdated
@@ -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? |
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.
These are all useful for debugging, I'd leave them.
src/backend/feed/worker.js
Outdated
@@ -33,6 +33,7 @@ exports.start = async function () { | |||
logger.info('Connected to elasticsearch!'); | |||
|
|||
const concurrency = getFeedWorkersCount(); | |||
//Change into debug? |
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.
Yeah, debug, agree.
src/backend/lib/shutdown.js
Outdated
@@ -11,6 +11,7 @@ async function stopQueue() { | |||
await feedQueue.close(); | |||
logger.info('Feed queue shut down.'); | |||
} catch (error) { | |||
//Change to debug? |
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.
Agree, debug here.
src/backend/lib/shutdown.js
Outdated
@@ -24,6 +25,7 @@ async function stopWebServer() { | |||
await serverClose(); | |||
logger.info('Web server shut down.'); | |||
} catch (error) { | |||
// Change to debug? |
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.
Yeah, debug for sure.
src/backend/lib/shutdown.js
Outdated
@@ -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 |
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.
Agree, debug.
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.
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", |
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.
What's the point of this? Ah, from the merge?
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.
Yup, it's cleaned out now :)
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.
Lookin' good!
Issue This PR Addresses
Fixes #1252
Type of Change
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