Switch to kibana3 link generation

This makes use of the kibana3 logstash dashboard's query and from
parameters to link in queries similar to how we linked in kibana2
queries with base64 encoding. This however uses a saner urlencode
instead of base64 so you should be able to read them as a human.

Note we shouldn't land this until we have switched logstash.o.o over to
kibana3.

Change-Id: Idc1d637db7e1142a24adab2d21bc747d3002dd56
Depends-On: I176148c3bdaf603a1703d215ac2086101ecabe21
This commit is contained in:
Clark Boylan 2015-10-14 13:22:44 -07:00
parent 71b7ff92de
commit 206b428681
4 changed files with 7 additions and 11 deletions

View File

@ -148,7 +148,8 @@ def classifying_rate(fails, data, engine, classifier):
'AND error_pr:["-1000.0" TO "-10.0"] '
% url['build_uuid'])
logstash_query = qb.encode_logstash_query(query)
logstash_url = 'http://logstash.openstack.org/#%s' % logstash_query
logstash_url = 'http://logstash.openstack.org' \
'/#/dashboard/file/logstash.json?%s' % logstash_query
results = classifier.hits_by_query(query, size=1)
if results:
url['crm114'] = logstash_url

View File

@ -18,8 +18,7 @@ A set of utility methods to build the kinds of queries that are needed
by elastic recheck to talk with elastic search.
"""
import base64
import json
from six.moves.urllib.parse import urlencode
def generic(raw_query, facet=None):
@ -134,9 +133,5 @@ def encode_logstash_query(query, timeframe=864000):
and an optional timeframe argument.
"""
urlq = dict(search=query,
fields=[],
offset=0,
timeframe=str(timeframe),
graphmode="count")
return base64.urlsafe_b64encode(json.dumps(urlq))
timeframe = str(timeframe) + 's'
return urlencode({'query': query, 'from': timeframe})

View File

@ -70,7 +70,7 @@
</div>
{{/if}}
<div class="graph"></div>
<a class="extlink" href="http://logstash.openstack.org/#{{bug.logstash_query}}">Logstash</a>
<a class="extlink" href="http://logstash.openstack.org/#/dashboard/file/logstash.json?{{bug.logstash_query}}">Logstash</a>
<a class="extlink" href="http://bugs.launchpad.net/bugs/{{bug.number}}">Launchpad</a>
</div>
</script>

View File

@ -73,7 +73,7 @@
</div>
{{/if}}
<div class="graph"></div>
<a class="extlink" href="http://logstash.openstack.org/#{{bug.logstash_query}}">Logstash</a>
<a class="extlink" href="http://logstash.openstack.org/#/dashboard/file/logstash.json?{{bug.logstash_query}}">Logstash</a>
<a class="extlink" href="http://bugs.launchpad.net/bugs/{{bug.number}}">Launchpad</a>
</div>
</script>