feat(xo-server-perf-alert): regroup items with missing stats in one email (#4413)
Fixes #5104
This commit is contained in:
parent
e3223b6124
commit
1b7441715c
@ -11,7 +11,7 @@
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [Audit] Fix integrity check feedback not displayed (PR [#5106](https://github.com/vatesfr/xen-orchestra/pull/5106))
|
||||
- [Perf alert] Regroup items with missing stats in one email [#3137](https://github.com/vatesfr/xen-orchestra/issues/3137) (PR [#4413](https://github.com/vatesfr/xen-orchestra/pull/4413))
|
||||
|
||||
### Packages to release
|
||||
|
||||
@ -30,4 +30,5 @@
|
||||
>
|
||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||
|
||||
- xo-server-perf-alert patch
|
||||
- xo-web minor
|
||||
|
@ -592,22 +592,11 @@ ${monitorBodies.join('\n')}`
|
||||
const monitors = this._getMonitors()
|
||||
for (const monitor of monitors) {
|
||||
const snapshot = await monitor.snapshot()
|
||||
for (const entry of snapshot) {
|
||||
raiseOrLowerAlarm(
|
||||
`${monitor.alarmId}|${entry.uuid}|RRD`,
|
||||
entry.value === undefined,
|
||||
() => {
|
||||
this._sendAlertEmail(
|
||||
'Secondary Issue',
|
||||
`
|
||||
## There was an issue when trying to check ${monitor.title}
|
||||
${entry.listItem}`
|
||||
)
|
||||
},
|
||||
() => {}
|
||||
)
|
||||
|
||||
const entriesWithMissingStats = []
|
||||
for (const entry of snapshot) {
|
||||
if (entry.value === undefined) {
|
||||
entriesWithMissingStats.push(entry)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -656,6 +645,23 @@ ${entry.listItem}
|
||||
lowerAlarm
|
||||
)
|
||||
}
|
||||
|
||||
raiseOrLowerAlarm(
|
||||
`${monitor.alarmId}|${entriesWithMissingStats
|
||||
.map(({ uuid }) => uuid)
|
||||
.sort()
|
||||
.join('|')}|RRD`,
|
||||
entriesWithMissingStats.length !== 0,
|
||||
() => {
|
||||
this._sendAlertEmail(
|
||||
'Secondary Issue',
|
||||
`
|
||||
## There was an issue when trying to check ${monitor.title}
|
||||
${entriesWithMissingStats.map(({ listItem }) => listItem).join('\n')}`
|
||||
)
|
||||
},
|
||||
() => {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user