From 0924c1b12f0874f990e1876fd186bb17ebacf597 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sun, 1 Dec 2013 08:52:51 -0500 Subject: [PATCH] add support for installing the web dashboard move the web dashboard from config tree into elastic recheck and make it installable into $prefix/share. Documentation on the expected way this would work is provided in the web sub tree. Also ensure that we actually fetch from /elastic-recheck/data as we expect people to set things up. Change-Id: I514b6cf2c18bb4d570f830d78e87e713b9c3531e --- setup.cfg | 2 + web/README.rst | 32 ++++++++++++ web/conf/elastic-recheck.conf | 15 ++++++ web/share/elastic-recheck.html | 90 ++++++++++++++++++++++++++++++++++ web/share/elastic-recheck.js | 64 ++++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 web/README.rst create mode 100644 web/conf/elastic-recheck.conf create mode 100644 web/share/elastic-recheck.html create mode 100644 web/share/elastic-recheck.js diff --git a/setup.cfg b/setup.cfg index e493dbd9..658a3933 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,6 +22,8 @@ classifier = [files] packages = elastic_recheck +data_files = + share/elastic-recheck = web/share/* [entry_points] console_scripts = diff --git a/web/README.rst b/web/README.rst new file mode 100644 index 00000000..e2736913 --- /dev/null +++ b/web/README.rst @@ -0,0 +1,32 @@ +=========================== + Elastic Recheck Dashboard +=========================== + +Elastic Recheck is a handy tool for mining the data in our logstash +environment to categorize race conditions in the OpenStack gate. In +addition to including a number of command line tools, we provide an +html dashboard, because the kids love that html. + +Architecture +============ + +The dashboard currently consists of static html and a set of +javascript libraries, which read json files full of data, and do +client side rendering of graphs. This may change in the future. + +Below this tree you'll find a set of sub-directories that assume that +you are running this in an apache environment. + + - static files - /usr/share/elastic-recheck + - dynamic json - /var/lib/elastic-recheck + - apache config - /etc/apache/conf.d/elastic-recheck.conf + +Json files directory is expected to be mapped to /elastic-recheck/data +and the static files to /elastic-recheck. + +Installation +============ + +At install time for elastic-recheck the static files are installed as +per our assumed location. The apache configuration is not changed, +however an example is provided in the conf directory. diff --git a/web/conf/elastic-recheck.conf b/web/conf/elastic-recheck.conf new file mode 100644 index 00000000..3e8b11a3 --- /dev/null +++ b/web/conf/elastic-recheck.conf @@ -0,0 +1,15 @@ +Alias /elastic-recheck /usr/share/elastic-recheck + + + Options FollowSymlinks + AllowOverride None + Require all granted + + +Alias /elastic-recheck/data /usr/share/elastic-recheck/data + + + Options FollowSymlinks + AllowOverride None + Require all granted + diff --git a/web/share/elastic-recheck.html b/web/share/elastic-recheck.html new file mode 100644 index 00000000..3c9b9a8a --- /dev/null +++ b/web/share/elastic-recheck.html @@ -0,0 +1,90 @@ + + + Elastic Recheck + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ + + + diff --git a/web/share/elastic-recheck.js b/web/share/elastic-recheck.js new file mode 100644 index 00000000..1c205e6c --- /dev/null +++ b/web/share/elastic-recheck.js @@ -0,0 +1,64 @@ +// Copyright 2013 OpenStack Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +function update() { + $.getJSON('http://status.openstack.org/elastic-recheck/data/graph.json', function(data) { + var seen = []; + $.each(data, function(i, bug) { + var id = 'bug-'+bug['number']; + seen.push(id); + var div = $('#'+id); + + if (!div.length) { + div = $('
', {'id': id, 'class': 'bug-container'}); + div.appendTo($('#main-container')); + $('

', {text: 'Bug ' + bug['number']}).appendTo(div); + $('
', {'class': 'graph'}).appendTo(div); + $('', { + href: 'http://logstash.openstack.org/#'+bug['logstash_query'], + text: 'Logstash' + }).appendTo($('', { + 'class': 'extlink' + }).appendTo(div)); + $('', { + href: 'https://bugs.launchpad.net/bugs/'+bug['number'], + text: 'Launchpad' + }).appendTo($('', { + 'class': 'extlink' + }).appendTo(div)); + } + div = div.find(".graph"); + + if (bug['data'].length > 0) { + $.plot(div, bug['data'], + {xaxis: { + mode: "time" + }} + ); + } else { + div.html("No matches"); + } + + }); + $.each($('.bug-container'), function(i, container) { + if (seen.indexOf(container.id) == -1) { + container.remove(); + } + }); + }); +} + +$(function() { + update(); +});