feat(intergral/alerting): HA partitioning#57
Merged
jhawksley-intergral merged 11 commits into12.3.x-intergralfrom Mar 29, 2026
Merged
feat(intergral/alerting): HA partitioning#57jhawksley-intergral merged 11 commits into12.3.x-intergralfrom
jhawksley-intergral merged 11 commits into12.3.x-intergralfrom
Conversation
- Add dynamicMockPeer with mutable membership for topology change simulation - Add unit tests: member joins, member leaves, healthy↔unhealthy transitions, rapid changes - Add fetcher integration tests: topology change triggers re-fetch, stable topology skips - Add withPartitioner option to setupScheduler for injecting partitioner in tests - Fix docker_build.yml: sanitize ref_name for valid Docker tags (replace / with -) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove extra field alignment spaces in SchedulerCfg (goimports) - Remove ineffectual assignment to peers in topology-change test (ineffassign) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ed rules - Add RuleFilter interface to state package, satisfied by schedule.RulePartitioner - Add refreshRemoteStates() to periodically load DB state for non-local rules into cache - Start background sync loop in Manager.Run() when partitioning is enabled - Add ha_scheduler_remote_state_sync_interval config option (default 30s) - Wire partitioner as RuleFilter in ngalert.go - Add tests for remote refresh, stale cleanup, topology change, and context cancellation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add package doc comment to state manager Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Skip orgs with no alert rules in refreshRemoteStates loop - Downgrade partitioner "HA partitioning applied" log from Info to Debug Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…te rules When HA partitioning is enabled, the scheduler only knows about locally assigned rules. API requests hitting a non-owning instance returned blank LastEvaluation because the scheduler had no status for remote rules. Now falls back to StatesToRuleStatus() using cached state from the remote state sync, so the UI shows correct "Next Evaluation" regardless of which instance serves the request. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84cf0fd to
aac9a04
Compare
Drain in-flight items after Close() before asserting channel closure. The emit select can non-deterministically deliver a pending item even after done is closed, causing spurious test failures under -race. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Adds HA (high-availability) partitioning for the unified alerting scheduler so that alert rule evaluation is distributed across cluster members using consistent hashing.
FNV-64a(orgID:ruleUID) % clusterSize. Partitioning is gated on a minimum cluster size and automatically falls back to full evaluation if the cluster is unhealthy.LastEvaluation/ rule status regardless of which instance serves the request.[unified_alerting.ha_scheduler]section indefaults.iniwithenabled,min_cluster_size, andremote_state_sync_intervaloptions.Files changed
schedule/partitioner.goschedule/schedule.go,schedule/fetcher.gostate/manager.goRuleFilterinterface, stale cleanupapi/prometheus/api_prometheus.goconf/defaults.ini,setting/setting_unified_alerting.gongalert.go,notifier/multiorg_alertmanager.gopartitioner_test.go,fetcher_test.go,manager_remote_state_test.goexpr/mathexp/parse/lex_test.godocker_build.ymlTest plan
🤖 Generated with Claude Code