Krinkle has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183614
Change subject: zuul: Update graphite graphs together with Zuul status
......................................................................
zuul: Update graphite graphs together with Zuul status
Using event handlers so that it also benefits from the same
interval and pausing mechanism (for when page is hidden).
Change-Id: Ib4c29d88f9920f1b9042d987caff543261021c1b
---
M org/wikimedia/integration/zuul/default.html
M org/wikimedia/integration/zuul/status.js
2 files changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/docroot
refs/changes/14/183614/1
diff --git a/org/wikimedia/integration/zuul/default.html
b/org/wikimedia/integration/zuul/default.html
index 00a83ff..4d07c26 100644
--- a/org/wikimedia/integration/zuul/default.html
+++ b/org/wikimedia/integration/zuul/default.html
@@ -6,14 +6,14 @@
<div id="zuul-pipelines" class="row"></div>
<!-- Courtesy of OpenStack Foundation -->
<h4>Job Stats</h4>
- <img title="Zuul processing"
src="//graphite.wikimedia.org/render/?from=-24hours
+ <img class="graphite-graph" title="Zuul processing"
src="//graphite.wikimedia.org/render/?from=-24hours
&height=180
&width=400
&areaMode=first
&lineMode=staircase
&target=alias(summarize(sumSeries(zuul.pipeline.*.current_changes.value),'1h'),'Changes')
&title=Zuul%20processing%20(per%20hour)" title="Zuul (per hour)" />
- <img title="Zuul test pipeline"
src="//graphite.wikimedia.org/render/?from=-24hours
+ <img class="graphite-graph" title="Zuul test pipeline"
src="//graphite.wikimedia.org/render/?from=-24hours
&height=180
&width=400
&areaMode=first
@@ -23,7 +23,7 @@
&target=alias(summarize(zuul.pipeline.test.current_changes.value,'1h','max'),'hourly
max')
&title=Zuul%20test%20pipeline" />
<br/>
- <img title="Zuul gate pipeline"
src="//graphite.wikimedia.org/render/?from=-24hours
+ <img class="graphite-graph" title="Zuul gate pipeline"
src="//graphite.wikimedia.org/render/?from=-24hours
&height=180
&width=400
&areaMode=first
@@ -32,7 +32,7 @@
&target=alias(summarize(zuul.pipeline.gate-and-submit.current_changes.value,'1min'),'1min
avg')
&target=alias(summarize(zuul.pipeline.gate-and-submit.current_changes.value,'1h','max'),'hourly
max')
&title=Zuul%20gate%20pipeline" />
- <img title="Zuul Geard Job Queue"
src="//graphite.wikimedia.org/render/?from=-8hours
+ <img class="graphite-graph" title="Zuul Geard Job Queue"
src="//graphite.wikimedia.org/render/?from=-8hours
&height=180
&width=400
&target=alias(color(zuul.geard.queue.running.value,'blue'),'Running')
diff --git a/org/wikimedia/integration/zuul/status.js
b/org/wikimedia/integration/zuul/status.js
index 3916f41..9c7836c 100644
--- a/org/wikimedia/integration/zuul/status.js
+++ b/org/wikimedia/integration/zuul/status.js
@@ -18,11 +18,13 @@
/*jshint camelcase:false */
(function ($) {
- var $container, $msg, $msgWrap, $indicator, prevHtml, xhr, zuul, $jq,
+ var $container, $msg, $msgWrap, $indicator, $jq, $graphs,
+ prevHtml, xhr, zuul,
demo = location.search.match(/[?&]demo=([^?&]*)/),
source = demo ?
'./sample-status-' + (demo[1] || 'basic') + '.json' :
- '/zuul/status.json';
+ '/zuul/status.json',
+ nonce = $.now();
/**
* Escape a string for HTML. Converts special characters to HTML
entities.
@@ -321,6 +323,13 @@
$jq = $(zuul);
+ $jq.one('update-start', function () {
+ // Store original image urls of graphs
+ $graphs = $('.graphite-graph').each(function (i, node) {
+ $.data(node, 'src', node.src);
+ });
+ });
+
$jq.on('update-start', function () {
$container.addClass('zuul-container-loading');
@@ -330,6 +339,11 @@
});
$jq.on('update-end', function () {
+ // Refresh graphs
+ $graphs.attr('src', function () {
+ return $.data(this, 'src') + '&_=' + ( nonce++ );
+ } );
+
$container.removeClass('zuul-container-loading');
setTimeout(function () {
// Delay so that the updating state is visible for at
least half a second
--
To view, visit https://gerrit.wikimedia.org/r/183614
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4c29d88f9920f1b9042d987caff543261021c1b
Gerrit-PatchSet: 1
Gerrit-Project: integration/docroot
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits