From 7b460351f5eed62696c174191e6a1c3d095fe574 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Tue, 11 Oct 2016 15:41:45 +0800 Subject: visualize qpi using kibana_dashboard JIRA: QTIP-122 Change-Id: Ice29c0a841e911b23959c91322331c5a66281be5 Signed-off-by: SerenaFeng --- .../dashboard/elastic2kibana/templates/qpi.json | 45 ++++++++++++++++++++++ .../dashboard/dashboard/mongo2elastic/format.py | 18 +++++++++ .../test/dashboard/dashboard/mongo2elastic/main.py | 10 ++++- utils/test/dashboard/dashboard/qtip/__init__.py | 0 utils/test/dashboard/dashboard/qtip/testcases.yaml | 28 ++++++++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json create mode 100644 utils/test/dashboard/dashboard/qtip/__init__.py create mode 100644 utils/test/dashboard/dashboard/qtip/testcases.yaml diff --git a/utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json b/utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json new file mode 100644 index 000000000..a46f315ef --- /dev/null +++ b/utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json @@ -0,0 +1,45 @@ +{% set aggs = aggs|default([]) -%} + +{ + "title": "qpi", + "type": "line", + "listeners": {}, + "params": { + "addLegend": true, + "shareYAxis": true, + "addTooltip": true, + "smoothLines": false, + "scale": "linear", + "interpolate": "linear", + "times": [], + "addTimeMarker": false, + "defaultYExtents": false, + "setYExtents": false, + "yAxis": {}, + "mode": "stacked" + }, + "aggs": [ + {% for agg in aggs %} + { + "id": {{agg.id }}, + "type": "avg", + "schema": "metric", + "params": { + "field": "{{agg.field}}" + } + }, + {% endfor %} + { + "id": {{ aggs|length + 1 }}, + "type": "date_histogram", + "schema": "segment", + "params": { + "field": "start_date", + "interval": "auto", + "customInterval": "2h", + "min_doc_count": 1, + "extended_bounds": {} + } + } + ] +} diff --git a/utils/test/dashboard/dashboard/mongo2elastic/format.py b/utils/test/dashboard/dashboard/mongo2elastic/format.py index ef485bae0..0bbde1746 100644 --- a/utils/test/dashboard/dashboard/mongo2elastic/format.py +++ b/utils/test/dashboard/dashboard/mongo2elastic/format.py @@ -184,3 +184,21 @@ def format_vims(testcase): } } return True + + +def format_qpi(testcase): + """ + Look for these and leave any of those: + details.index + + If none are present, then return False + """ + details = testcase['details'] + if 'index' not in details: + return False + + for key, value in details.items(): + if key != 'index': + del details[key] + + return True diff --git a/utils/test/dashboard/dashboard/mongo2elastic/main.py b/utils/test/dashboard/dashboard/mongo2elastic/main.py index a526d5319..303d82c6f 100644 --- a/utils/test/dashboard/dashboard/mongo2elastic/main.py +++ b/utils/test/dashboard/dashboard/mongo2elastic/main.py @@ -91,10 +91,16 @@ class DocumentVerification(object): return self.skip def _fix_date(self, date_string): + if date_string == 'None': + return None if isinstance(date_string, dict): return date_string['$date'] - else: - return date_string[:-3].replace(' ', 'T') + 'Z' + if 'T' not in date_string: + date_string = date_string[:-3].replace(' ', 'T') + if not date_string.endswith('Z'): + date_string += 'Z' + + return date_string class DocumentPublisher(object): diff --git a/utils/test/dashboard/dashboard/qtip/__init__.py b/utils/test/dashboard/dashboard/qtip/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/utils/test/dashboard/dashboard/qtip/testcases.yaml b/utils/test/dashboard/dashboard/qtip/testcases.yaml new file mode 100644 index 000000000..cd337cd73 --- /dev/null +++ b/utils/test/dashboard/dashboard/qtip/testcases.yaml @@ -0,0 +1,28 @@ +qtip: + - + name: compute_test_suite + format: qpi + test_family: compute + visualizations: + - + name: qpi + fields: + - field: details.index + - + name: network_test_suite + test_family: network + format: qpi + visualizations: + - + name: qpi + fields: + - field: details.index + - + name:storage_test_suite + format: qpi + test_family: storage + visualizations: + - + name: qpi + fields: + - field: details.index -- cgit 1.2.3-korg