summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-12-20 00:20:17 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-12-20 00:20:17 +0200
commit931eb66b3f9da273988f9a5961d6134fa4500af1 (patch)
treec9a9e81cf0eb0190415ffb84a1d305e6dc31f48b /web
parent9e61a9ba83f5fa23cae0246585cc478504a4cecb (diff)
allow dashboards to retry fetching chart data on failures; fixes #1402
Diffstat (limited to 'web')
-rw-r--r--web/dashboard.js20
-rw-r--r--web/demosites.html5
-rw-r--r--web/index.html5
3 files changed, 26 insertions, 4 deletions
diff --git a/web/dashboard.js b/web/dashboard.js
index a62b31d4ae..0db567107a 100644
--- a/web/dashboard.js
+++ b/web/dashboard.js
@@ -332,6 +332,8 @@
async_on_scroll: false, // sync/async onscroll handler
onscroll_worker_duration_threshold: 30, // time in ms, to consider slow the onscroll handler
+ retries_on_data_failures: 3, // how many retries to make if we can't fetch chart data from the server
+
setOptionCallback: function() { ; }
},
@@ -1231,6 +1233,9 @@
// the chart library requested by the user
this.library_name = self.data('chart-library') || NETDATA.chartDefaults.library;
+ // how many retries we have made to load chart data from the server
+ this.retries_on_data_failures = 0;
+
// object - the chart library used
this.library = null;
@@ -3077,6 +3082,7 @@
})
.done(function(data) {
that.xhr = undefined;
+ that.retries_on_data_failures = 0;
if(that.debug === true)
that.log('data received. updating chart.');
@@ -3086,8 +3092,18 @@
.fail(function(msg) {
that.xhr = undefined;
- if(msg.statusText !== 'abort')
- error('data download failed for url: ' + that.data_url);
+ if(msg.statusText !== 'abort') {
+ that.retries_on_data_failures++;
+ if(that.retries_on_data_failures > NETDATA.options.current.retries_on_data_failures) {
+ // that.log('failed ' + that.retries_on_data_failures.toString() + ' times - giving up');
+ that.retries_on_data_failures = 0;
+ error('data download failed for url: ' + that.data_url);
+ }
+ else {
+ that.tm.last_autorefreshed = Date.now();
+ // that.log('failed ' + that.retries_on_data_failures.toString() + ' times, but I will retry');
+ }
+ }
})
.always(function() {
that.xhr = undefined;
diff --git a/web/demosites.html b/web/demosites.html
index 63a62d6966..e212e4cd0a 100644
--- a/web/demosites.html
+++ b/web/demosites.html
@@ -505,7 +505,7 @@ p {
and that you have chown it to be owned by netdata:netdata
-->
<!-- <script type="text/javascript" src="http://my.server:19999/dashboard.js"></script> -->
-<script type="text/javascript" src="dashboard.js?v20161218-1"></script>
+<script type="text/javascript" src="dashboard.js?v20161219-1"></script>
<script>
// --- OPTIONS FOR THE CHARTS --
@@ -529,6 +529,9 @@ p {
// since we have many servers and limited sockets,
// abort ajax calls when we scroll
NETDATA.options.current.abort_ajax_on_scroll = true;
+
+ // do not to give errors on netdata demo servers for 60 seconds
+ NETDATA.options.current.retries_on_data_failures = 60;
</script>
<style>
diff --git a/web/index.html b/web/index.html
index 491b772ba4..64ca0aef8b 100644
--- a/web/index.html
+++ b/web/index.html
@@ -2511,6 +2511,9 @@
});
if(isdemo()) {
+ // do not to give errors on netdata demo servers for 60 seconds
+ NETDATA.options.current.retries_on_data_failures = 60;
+
if(urlOptions.nowelcome !== true) {
setTimeout(function() {
$('#welcomeModal').modal();
@@ -3185,4 +3188,4 @@
</div>
</body>
</html>
-<script type="text/javascript" src="dashboard.js?v20161218-5"></script>
+<script type="text/javascript" src="dashboard.js?v20161219-1"></script>