Bug description
In a multi-org SigNoz deployment, when the rule manager initializes at startup (initiate()), it iterates over all organizations to load their stored alert rules. However, if any organization in the list has no rules, the function executes return nil immediately. This silently terminates the entire startup loop, abandoning all subsequent organizations and their rules.
Affected code — pkg/query-service/rules/manager.go, lines 262–264:
if len(storedRules) == 0 {
return nil // BUG: exits the entire function instead of just skipping this org
}
As a result, any organization that happens to be iterated after an empty-rules org will have zero alert rules loaded at startup. All alerts for those orgs are silently lost.
Expected behaviour
When an organisation has no stored rules (len(storedRules) == 0), the loop should skip that organisation and continue processing rules for all remaining organisations. No alerts from any organisation should be silently dropped at startup.
The code should be:
if len(storedRules) == 0 {
continue
}
How to reproduce
- Create two organisations in SigNoz (multi-org setup).
- In the first organisation (the one that appears first in the database), do not create any alert rules.
- In the second organisation, create at least one alert rule.
- Restart the SigNoz query-service / backend.
- Observe: The second organisation's alert rules are not scheduled for evaluation after startup, and no error is logged.
Version information
- Signoz version: v0.132.0 (current
main branch, introduced in commit 91cbd1727551621a863828b7280f5f7e15b39ca7)
- Browser version: N/A (Backend issue)
- Your OS and version: Any (Linux/macOS/Docker)
- Your CPU Architecture(ARM/Intel): Any
Additional context
The default sharder (noopsharder) returns the full key range [0, MaxUint32], so ListByOwnedKeyRange returns all organisations in the database. This means the bug is active in every standard self-hosted deployment that has more than one organisation.
This was likely a copy-paste oversight from when this function was refactored from a single-org loop to a multi-org loop (PR #8107). The impact is a silent failure where the system appears healthy but monitoring coverage is dropped for subsequent organisations.
Bug description
In a multi-org SigNoz deployment, when the rule manager initializes at startup (
initiate()), it iterates over all organizations to load their stored alert rules. However, if any organization in the list has no rules, the function executesreturn nilimmediately. This silently terminates the entire startup loop, abandoning all subsequent organizations and their rules.Affected code —
pkg/query-service/rules/manager.go, lines 262–264:As a result, any organization that happens to be iterated after an empty-rules org will have zero alert rules loaded at startup. All alerts for those orgs are silently lost.
Expected behaviour
When an organisation has no stored rules (
len(storedRules) == 0), the loop should skip that organisation and continue processing rules for all remaining organisations. No alerts from any organisation should be silently dropped at startup.The code should be:
How to reproduce
Version information
mainbranch, introduced in commit91cbd1727551621a863828b7280f5f7e15b39ca7)Additional context
The default sharder (
noopsharder) returns the full key range[0, MaxUint32], soListByOwnedKeyRangereturns all organisations in the database. This means the bug is active in every standard self-hosted deployment that has more than one organisation.This was likely a copy-paste oversight from when this function was refactored from a single-org loop to a multi-org loop (PR #8107). The impact is a silent failure where the system appears healthy but monitoring coverage is dropped for subsequent organisations.