-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MonitoringService): consolidate monitor result history into Stat…
…usInfos
- Loading branch information
1 parent
36d6a6d
commit c11eaca
Showing
8 changed files
with
115 additions
and
135 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* This file belongs to Hoist, an application development toolkit | ||
* developed by Extremely Heavy Industries (www.xh.io | [email protected]) | ||
* | ||
* Copyright © 2023 Extremely Heavy Industries Inc. | ||
* Copyright © 2024 Extremely Heavy Industries Inc. | ||
*/ | ||
|
||
package io.xh.hoist.monitor | ||
|
@@ -15,8 +15,7 @@ import static io.xh.hoist.monitor.MonitorStatus.UNKNOWN | |
@CompileStatic | ||
class MonitorInfo implements JSONFormat { | ||
Monitor monitor | ||
MonitorStatus status = UNKNOWN | ||
Date lastStatusChange | ||
StatusInfo statusInfo | ||
List<MonitorResult> instanceResults = [] | ||
|
||
String getCode() { | ||
|
@@ -29,9 +28,8 @@ class MonitorInfo implements JSONFormat { | |
name: monitor.name, | ||
sortOrder: monitor.sortOrder, | ||
masterOnly: monitor.masterOnly, | ||
status: status, | ||
lastStatusChange: lastStatusChange, | ||
metricUnit: monitor.metricUnit, | ||
statusInfo: statusInfo, | ||
instanceResults: instanceResults | ||
] | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,45 @@ | ||
/* | ||
* This file belongs to Hoist, an application development toolkit | ||
* developed by Extremely Heavy Industries (www.xh.io | [email protected]) | ||
* | ||
* Copyright © 2024 Extremely Heavy Industries Inc. | ||
*/ | ||
|
||
package io.xh.hoist.monitor | ||
|
||
import io.xh.hoist.util.Utils | ||
|
||
import static io.xh.hoist.monitor.MonitorStatus.* | ||
|
||
|
||
class StatusInfo { | ||
MonitorStatus status | ||
MonitorStatus status = UNKNOWN | ||
Date lastChange | ||
Integer cyclesAsSuccess | ||
Integer cyclesAsFail | ||
Integer cyclesAsWarn | ||
|
||
void recordStatus(MonitorStatus status) { | ||
// Keep track of the number of consecutive cycles in each status | ||
switch (status) { | ||
case FAIL: | ||
cyclesAsSuccess = 0 | ||
cyclesAsFail++ | ||
break | ||
case WARN: | ||
cyclesAsSuccess = 0 | ||
cyclesAsFail = 0 | ||
cyclesAsWarn++ | ||
break | ||
case OK: | ||
cyclesAsFail = 0 | ||
cyclesAsWarn = 0 | ||
cyclesAsSuccess++ | ||
break | ||
} | ||
if (status != this.status) { | ||
this.status = status | ||
lastChange = new Date() | ||
} | ||
} | ||
} |
Oops, something went wrong.