Remove dynamic watchdog

JS code have a watchdog timer that will check if last data from unsee isn't too old, if that happens it will print an error in the UI and reload the page. This is a fail safe for weird bugs and cases where unsee is running unattended. Currently timeout for this watchdog is configured dynamically based on refresh rate, but if the backend is configured to pull data from Alertmanager less often than watchdog tolerance, then watchdog will trigger false positive. This commit changes watchdog tolerance to 15 minutes (it seems reasonable to assume people won't use Alertmanager pull interval longer than 1-5 minutes) and adds a note to the readme.
This commit is contained in:
Łukasz Mierzwa
2017-03-31 23:46:56 -07:00
parent 1fa511f352
commit 7e8dc0c0ff
4 changed files with 8 additions and 10 deletions

View File

@@ -97,6 +97,11 @@ This option can also be set using `-alertmanager.ttl` flag. Example:
Default is `1m`.
Note that the maximum value for this option is `15m`.
The UI has a watchdog that tracks the timestamp of the last pull. If the UI
does not receive updates for more than 15 minutes it will print an error and
reload the page.
#### ALERTMANAGER_URI
URI of the Alertmanager instance, unsee will use it to pull alert groups and

View File

@@ -26,7 +26,7 @@ var Unsee = (function(params) {
Grid.Init();
Autocomplete.Init();
Filters.Init();
Watchdog.Init(10, 300);
Watchdog.Init(30, 60*15); // set watchdog to 15 minutes
$(selectors.refreshButton).click(function() {
if (!$(selectors.refreshButton).prop('disabled')) {
@@ -53,7 +53,6 @@ var Unsee = (function(params) {
}
}
refreshInterval = rate;
Watchdog.UpdateTolerance(rate);
Progress.Reset();
}

View File

@@ -54,11 +54,6 @@ var Watchdog = (function() {
}
updateMaxLag = function(interval) {
maxLag = Math.max(interval + 50, 300);
}
updateTs = function(ts) {
lastTs = ts;
}
@@ -75,7 +70,6 @@ var Watchdog = (function() {
return {
Init: init,
UpdateTolerance: updateMaxLag,
Pong: updateTs,
GetLastUpdate: getTs,
IsFatal: getFatal

File diff suppressed because one or more lines are too long