From 8e68f222cc4bf95aacfa395c9e849c71a838ace9 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 11 Dec 2013 09:19:47 -0500 Subject: [PATCH] refactor graphite stanzas for readability this refactors the graphite stanzas to something that's more readable, and makes it simpler to add new ones later without lots of copy / paste. Change-Id: I077d54ce885ba3bbcc0ceca4f05959f508a88e96 --- web/share/elastic-recheck.js | 9 +++++++++ web/share/index.html | 30 ++++++------------------------ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/web/share/elastic-recheck.js b/web/share/elastic-recheck.js index 1c205e6c..3ce60758 100644 --- a/web/share/elastic-recheck.js +++ b/web/share/elastic-recheck.js @@ -12,6 +12,15 @@ // License for the specific language governing permissions and limitations // under the License. +function graphite_moving_avg(job, color) { + var time = '5hours'; + var graph = "color(alias(movingAverage(asPercent("; + graph += "stats.zuul.pipeline.gate.job." + job + ".FAILURE,"; + graph += "sum(stats.zuul.pipeline.gate.job." + job + ".{SUCCESS,FAILURE})"; + graph += "),'" + time + "'), '" + job + "'),'" + color + "')"; + return graph; +} + function update() { $.getJSON('http://status.openstack.org/elastic-recheck/data/graph.json', function(data) { var seen = []; diff --git a/web/share/index.html b/web/share/index.html index 9e7b2eea..ea807c6b 100644 --- a/web/share/index.html +++ b/web/share/index.html @@ -77,30 +77,12 @@ $("#graph-container").append($(new Image()).graphite({ yMax: 100, yMin: 0, target: [ - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-tempest-dsvm-neutron.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-tempest-dsvm-neutron.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-tempest-dsvm-neutron'),'00c868')", - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-tempest-dsvm-full.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-tempest-dsvm-full.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-tempest-dsvm-full'),'00FF00')", - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-grenade-dsvm.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-grenade-dsvm.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-grenade-dsvm'),'800080')", - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-tempest-dsvm-large-ops.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-tempest-dsvm-large-ops.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-tempest-dsvm-large-ops'),'00F0F0')", - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-tempest-dsvm-neutron-large-ops.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-tempest-dsvm-neutron-large-ops.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-tempest-dsvm-neutron-large-ops'),'E080FF')", - "color(alias(movingAverage(asPercent(\ - stats.zuul.pipeline.gate.job.gate-tempest-dsvm-postgres-full.FAILURE,\ - sum(stats.zuul.pipeline.gate.job.gate-tempest-dsvm-postgres-full.{SUCCESS,FAILURE})\ - ),'5hours'), 'gate-tempest-dsvm-postgres-full'),'ED9121')", + graphite_moving_avg("gate-tempest-dsvm-neutron", "00c868"), + graphite_moving_avg("gate-tempest-dsvm-full","00FF00"), + graphite_moving_avg("gate-grenade-dsvm","800080"), + graphite_moving_avg("gate-tempest-dsvm-large-ops","00F0F0"), + graphite_moving_avg("gate-tempest-dsvm-neutron-large-ops","E080FF"), + graphite_moving_avg("gate-tempest-dsvm-postgres-full","ED9121") ], title: "Gate Failure Rates" }));