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

Log Errors to Slack Channel #283

Merged
merged 1 commit into from
May 6, 2024

Conversation

bogdankharchenko
Copy link
Collaborator

@bogdankharchenko bogdankharchenko commented May 1, 2024

Error Logging

This will post regular error logs to a slack channel

We can change the reporting from "debug" into "critical" if we are dealing with too much noise.

Deploy Steps

  • Configure .env in Stage + Prod -> LOG_SLACK_WEBHOOK_URL=

Copy link
Member

@oliviasculley oliviasculley left a comment

Choose a reason for hiding this comment

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

Looks great!

@allella
Copy link
Member

allella commented May 1, 2024

We have an existing #hg-labs-slackbot-debugging-spam channel with a web hook that's set in the .env already with the ability to post to that channel from stage for testing. That testing webhook is only going to happen rarely so it's rather underused.

We could rename the channel and variables a bit and use them for these debugging / testing purposes. Then, we don't need to setup, maintain, and have people joining niche channels when one will probably suffice at this point.

@bogdankharchenko
Copy link
Collaborator Author

We have an existing #hg-labs-slackbot-debugging-spam channel with a web hook that's set already in the .env already has the ability to post to that channel from stage for testing. That testing webhook is only going to happen rarely so it's rather underused.

We could rename the channel and variables a bit and use them for these debugging / testing purposes. Then, we don't need to setup, maintain, and have people joining niche channels when one will probably suffice at this point.

Sure - no problem

@allella
Copy link
Member

allella commented May 2, 2024

Also, given the potential to expose server details, perhaps we'd want to make this a private channel.

@allella
Copy link
Member

allella commented May 2, 2024

With Women Who Code being shut down, and their Meetup page going missing, it caused an error in the logs that didn't exactly help expose which group.

This highlights an area for improving our catching of errors, particularly since we're going to push the logs to Slack.

I previously added the following to the Meetup importer mapIntoVenueData()
to temporarily debug an exception. It helped in that earlier case, but not in this one because the latest exception is in initialApiCall().

We can make a new issue for this, but it's fairly related, so perhaps we could address it in this PR.

Basically, can be catch more exceptions and dump the offending organization name / details, so it's not so cumbersome to figure out which group an exception is occurring on?

--- a/app-modules/event-importer/src/Services/MeetupRestHandler.php
+++ b/app-modules/event-importer/src/Services/MeetupRestHandler.php
@@ -89,6 +89,7 @@ class MeetupRestHandler extends AbstractEventHandler
                 'lon' => $data['venue']['lon'],
             ]);
         } catch (Throwable $exception) {
+report(print_r($data,true));
             report($exception);

The most recent error really only shows it was an issue in MeetupRestHandler.php and I had to run the importer and see the last successful org to be imported, which was "Upstate Ruby", to figure out that the next org was Women Who Code.

image

@bogdankharchenko
Copy link
Collaborator Author

Let's do one item at a time - let's make sure this PR works, figure out the more detailed debug messages later

@bogdankharchenko
Copy link
Collaborator Author

@allella go ahead a merge + deploy when you are comfortable to setup that .env variable

@allella
Copy link
Member

allella commented May 3, 2024

@bogdankharchenko is LOG_SLACK_WEBHOOK_URL still the name of the .env variable?

Do we want to note that in the example .env files?

@allella allella merged commit 1b59bff into hackgvl:develop May 6, 2024
1 check passed
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.

4 participants