hackgvl / hackgreenville-com

HackGreenville's Website
https://hackgreenville.com
MIT License
16 stars 15 forks source link

Log Errors to Slack Channel #283

Closed bogdankharchenko closed 1 week ago

bogdankharchenko commented 2 weeks ago

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

allella commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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

allella commented 2 weeks ago

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 commented 2 weeks ago

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

bogdankharchenko commented 2 weeks ago

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

allella commented 2 weeks ago

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

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