mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
fix(notifications): stop embedding Local in janitor alerts (#1631)
Fleet-aggregated reclaim alerts showed Node Local in the body while the badge already named the remote. Use a node-neutral message so identity comes from the hub badge; leave stored rows unchanged.
This commit is contained in:
@@ -1453,7 +1453,7 @@ describe('MonitorService - janitor cycle and circuit breaker', () => {
|
||||
expect(mockGetDiskUsage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('dispatches an alert when reclaimable exceeds the threshold', async () => {
|
||||
it('dispatches a node-neutral janitor alert', async () => {
|
||||
mockGetGlobalSettings.mockReturnValue({ docker_janitor_gb: '0.5' });
|
||||
mockGetDiskUsage.mockResolvedValue(RECLAIMABLE_3GB);
|
||||
mockGetSystemState.mockReturnValue('0'); // No prior alert; cooldown elapsed.
|
||||
@@ -1462,7 +1462,10 @@ describe('MonitorService - janitor cycle and circuit breaker', () => {
|
||||
await (svc as any).evaluateJanitor();
|
||||
|
||||
expect(mockDispatchAlert).toHaveBeenCalledWith(
|
||||
'info', 'system', expect.stringContaining('3.0 GB'), { stackName: undefined, actor: 'system:monitor' },
|
||||
'info',
|
||||
'system',
|
||||
'This node has accumulated 3.0 GB of unused Docker data. Open Resources to reclaim space, or set up a Prune Node Resources schedule.',
|
||||
{ stackName: undefined, actor: 'system:monitor' },
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -439,15 +439,14 @@ export class MonitorService {
|
||||
const MIN_RECLAIMABLE_GB = 0.1;
|
||||
|
||||
if (reclaimGb >= janitorLimitGb && reclaimGb >= MIN_RECLAIMABLE_GB) {
|
||||
const registry = NodeRegistry.getInstance();
|
||||
const localNode = registry.getNode(registry.getDefaultNodeId());
|
||||
const nodeLabel = localNode?.name ?? 'this node';
|
||||
// Node-neutral body: the hub bell badge attributes remotes.
|
||||
// Embedding the local seed name ("Local") made fleet alerts look wrong.
|
||||
await this.dispatchWithCooldown(
|
||||
HOST_ALERT_KEYS.janitor,
|
||||
JANITOR_COOLDOWN_MS,
|
||||
'info',
|
||||
'system',
|
||||
`Node "${nodeLabel}" has accumulated ${reclaimGb.toFixed(1)} GB of unused Docker data. Open Resources to reclaim space, or set up a Prune Node Resources schedule.`,
|
||||
`This node has accumulated ${reclaimGb.toFixed(1)} GB of unused Docker data. Open Resources to reclaim space, or set up a Prune Node Resources schedule.`,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -324,7 +324,7 @@ The entire host threshold evaluation can be silenced per node from **Settings ·
|
||||
|
||||
### Reclaimable Docker data
|
||||
|
||||
`info`/`system`: `Node "<name>" has accumulated <N> GB of unused Docker data. Open Resources to reclaim space, or set up a Prune Node Resources schedule.` 24-hour cooldown.
|
||||
`info`/`system`: `This node has accumulated <N> GB of unused Docker data. Open Resources to reclaim space, or set up a Prune Node Resources schedule.` 24-hour cooldown. On a multi-node fleet the bell attributes remotes with a node-name badge rather than embedding the name in the message.
|
||||
|
||||
### Sencho version availability
|
||||
|
||||
|
||||
Reference in New Issue
Block a user