Skip to content

Add Slack notification to healthcheck #23162

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

Merged
merged 3 commits into from
Mar 14, 2025
Merged

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Mar 12, 2025

Fixes: mozilla/addons#15440

Description

  • Updated the health check workflow to generate health check output and message JSON files.
  • Introduced a new script, health_check_blocks.py, to format health check data for Slack notifications.
  • Modified health_check.py to support output file generation and improved error handling.
  • Added tests for the new health check block formatting functionality.
  • Updated the workflow to send notifications to Slack with health check results, excluding local environment notifications.

Context

This enahnces the healthcheck to add slack notifications when there are failures and a notification if the workflow fails for any reason.

image

Testing

You can run the healtcheck locally, modifying monitors to get different results. set an --output property to save the file.

health_check_file="health_check.json"
health_check_blocks_file="health_check_blocks.json"
env="local"
./scripts/health_check.py --env $env --output $health_check_file --retries 0
./scripts/health_check_blocks.py --input $health_check_file --out $health_check_blocks_file

Then you can execute the bash script line by line to se what the final payload to slack would look like..

Finallly you can execute the healthcheck via github actions on this branch

gh workflow run health_check.yml --ref kevinmind/addons/15440

This PR introduces a temp failing monitor that should trigger a notifaction to the channel.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

@KevinMind KevinMind force-pushed the kevinmind/addons/15440 branch 30 times, most recently from ad045c2 to e0694ac Compare March 13, 2025 16:45
@KevinMind KevinMind force-pushed the kevinmind/addons/15440 branch 5 times, most recently from 7de35b4 to b2dad85 Compare March 13, 2025 19:50
- Updated the health check workflow to generate health check output and message JSON files.
- Introduced a new script, `health_check_blocks.py`, to format health check data for Slack notifications.
- Modified `health_check.py` to support output file generation and improved error handling.
- Added tests for the new health check block formatting functionality.
- Updated the workflow to send notifications to Slack with health check results, excluding local environment notifications.
@KevinMind KevinMind force-pushed the kevinmind/addons/15440 branch from b2dad85 to 65e7fe1 Compare March 14, 2025 09:20
@KevinMind KevinMind requested review from a team and diox and removed request for a team March 14, 2025 10:59
@KevinMind KevinMind merged commit e21aa9a into master Mar 14, 2025
42 checks passed
@KevinMind KevinMind deleted the kevinmind/addons/15440 branch March 14, 2025 15:19
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.

[Task]: Add slack notification for failing services
2 participants