-
Notifications
You must be signed in to change notification settings - Fork 446
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
Monitor and alert on errors in cron jobs #24347
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
6a49421
add stack trace to cron job panic recovery
sgress454 85cdaee
update tests
sgress454 d18791f
schedule updates
sgress454 d67a557
add migration
sgress454 3cbe83f
update cron schedule errors, tests
sgress454 aa48034
make new topics for p1 and p2 alerts
sgress454 2afe530
don't change default slack module name
sgress454 f13e6d6
add new alert
sgress454 091304c
send to correct topic
sgress454 7c15ef2
don't change default cron sns topic name
sgress454 80a165a
Merge branch 'main' into 19930-alert-cron-failures
sgress454 49b503d
add changelog
sgress454 cf244ea
lint
sgress454 5a066a8
revert dogfood tf changes (will make separate PR)
sgress454 1ac2df1
update migration timestamp
sgress454 0af018e
add monitor interval var
sgress454 f08c4c3
use lambda duration, not cron duration
sgress454 790c134
update schema.sql
sgress454 4efe16d
Merge branch 'main' into 19930-alert-cron-failures
sgress454 c4339be
Merge branch 'main' into 19930-alert-cron-failures
sgress454 cbfc575
handle nulls in test
sgress454 6fe214d
Merge branch 'main' into 19930-alert-cron-failures
sgress454 9b4ad8b
update migration
sgress454 1a1f97a
removed "errors" from GetLatestCronStats return val
sgress454 0f077ad
Merge branch 'main' into 19930-alert-cron-failures
sgress454 4979484
update schema.sql
sgress454 8115750
Merge branch 'main' into 19930-alert-cron-failures
sgress454 c765339
Merge branch 'main' into 19930-alert-cron-failures
sgress454 bb56e25
update monitoring readme
sgress454 72f845f
don't commit lock file
sgress454 31dd84b
allow test to recover from panic
sgress454 97cdca2
Merge branch 'main' into 19930-alert-cron-failures
sgress454 d347593
Merge branch 'main' into 19930-alert-cron-failures
sgress454 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Send alert via SNS when a scheduled "cron" job returns errors | ||
- SNS topic for job error alerts can be configured separately from the existing monitor alert by adding "cron_job_failure_monitoring" to sns_topic_arns_map, otherwise defaults to the using the same topic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
server/datastore/mysql/migrations/tables/20241210140021_AddErrorsToCronStatsTable.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tables | ||
|
||
import ( | ||
"database/sql" | ||
"fmt" | ||
) | ||
|
||
func init() { | ||
MigrationClient.AddMigration(Up_20241126140021, Down_20241126140021) | ||
} | ||
|
||
func Up_20241126140021(tx *sql.Tx) error { | ||
// Add columns | ||
_, err := tx.Exec(`ALTER TABLE cron_stats ADD COLUMN errors JSON`) | ||
if err != nil { | ||
return fmt.Errorf("failed to add errors to cron_stats: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
func Down_20241126140021(tx *sql.Tx) error { | ||
return nil | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
New type to hold errors from a cron schedule and turn them into a JSON string.