Repository navigation
feat(#1573): boot SLO alert, anomaly detector, and slow-query alerter… - #1657
Open
onitsha-droid wants to merge 1 commit into
Open
onitsha-droid wants to merge 1 commit into
onitsha-droid wants to merge 1 commit into
Conversation
|
@onitsha-droid Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Wires the SLO burn-rate alerter, usage anomaly detector, and slow-query alerter into application startup via
startBackgroundJobsinsrc/lifecycle/jobs.tsand registers each active job with graceful shutdown insrc/index.ts.Closes #1573
Changes
SLOW_QUERY_ALERTER_ENABLED(src/config/execution-env.ts) andSLO_ALERT_ENABLED(src/config/slo-env.ts).src/config/service-settings.tssoslowQueryAlerter.enableddefaults off whenSLOW_QUERY_ALERT_WEBHOOK_URLis empty,sloAlert.enableddefaults off whenSLO_ALERT_WEBHOOK_URLorSLO_ROUTE_CONFIGSis empty, and each job tracksexplicitlyEnabled.SLOW_QUERY_ALERTER_ENABLEDandSLO_ALERT_ENABLEDin.env.example.startBackgroundJobsinsrc/lifecycle/jobs.tsto instantiate and startsloAlertJob(includinginitSloRecorder),anomalyDetectorJob, andslowQueryAlerterJobwhen enabled, passing the sharedpooland registering{ name, beginShutdown, awaitIdle }(slo-alert,anomaly-detector,slow-query-alerter) insubsystems.startConfiguredJobto log and skip misconfigured auto-enabled jobs while throwing a clear boot error when a job is explicitly enabled....subsystemsfromstartBackgroundJobsintoshutdownSubsystemsinsrc/index.ts(and cleaned up merge-artifact syntax errors insrc/index.ts,src/lifecycle/jobs.ts, andsrc/lifecycle/jobs.test.ts).docs/graceful-shutdown.mdto listslo-alert,anomaly-detector, andslow-query-alerteras drained subsystems.src/lifecycle/jobs.test.tsand toggle parsing tests insrc/config/env.test.ts.Testing
npx jest src/lifecycle/jobs.test.ts --testNamePattern="creates no timers or subsystems when all toggles are off|starts sloAlert, anomalyDetector, and slowQueryAlerter|throws a clear boot error when an explicitly enabled job|logs and skips a misconfigured job"— 4/4 passednpm test -- src/workers/anomalyDetector.test.ts src/workers/slowQueryAlerter.test.ts— 2/2 suites passedJEST_RUN_QUARANTINED=1 npx jest src/workers/sloAlertJob.test.ts— 18/18 passedJEST_RUN_QUARANTINED=1 npx jest src/config/env.test.ts— newenv schema — alert job togglestests passed (8 pre-existing failures in unrelated suites in that file)npx tsc --noEmit— 0 errors in modified source files (src/index.ts,src/lifecycle/jobs.ts,src/config/execution-env.ts,src/config/slo-env.ts,src/config/service-settings.ts)