Generate visualisartions from mustache template
authorvarac <varacanero@zeromail.org>
Tue, 11 Apr 2017 14:59:55 +0000 (16:59 +0200)
committervarac <varacanero@zeromail.org>
Tue, 11 Apr 2017 14:59:55 +0000 (16:59 +0200)
.gitignore [new file with mode: 0644]
elastic/README.md
elastic/generate-config.py [new file with mode: 0755]
elastic/visualization/template.mustache [new file with mode: 0644]
elastic/visualization/test_upload_20_500k.json [deleted file]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..3716f11
--- /dev/null
@@ -0,0 +1 @@
+/elastic/visualization/*.json
index 7d786c6..fb91e1b 100644 (file)
@@ -1,5 +1,9 @@
 # Kibana Soledad Benchmark Dashboard
 
+## Generate visualisations from template
+
+    ./generate-config.py
+
 ## Upload configs
 
 Provide kibana admin credentials in your `~/.netrc` file.
diff --git a/elastic/generate-config.py b/elastic/generate-config.py
new file mode 100755 (executable)
index 0000000..f26d03d
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+
+import pystache
+
+#print(pystache.render('Hi {{person}}!', {'person': 'Mom'}))
+
+tests = [
+    'test_encrypt_raw_10M',
+    # 'test_encrypt_raw_100k',
+    # 'test_encrypt_raw_10k',
+    # 'test_decrypt_raw_100k',
+    # 'test_decrypt_raw_10M',
+    # 'test_decrypt_raw_10k',
+    # 'test_decrypt_raw_1M',
+    # 'test_decrypt_raw_500k',
+    # 'test_encrypt_raw_1M',
+    # 'test_encrypt_raw_500k',
+    # 'test_initialization',
+    # 'test_async_create_1000_10k',
+    # 'test_async_create_100_100k',
+    # 'test_create_1000_10k',
+    # 'test_create_100_100k',
+    # 'test_create_20_500k',
+    # 'test_decrypt_doc_100k',
+    # 'test_decrypt_doc_10M',
+    # 'test_decrypt_doc_10k',
+    #'test_decrypt_doc_1M'
+    ]
+
+DIR = './visualization/'
+
+template = open(DIR + 'template.mustache', 'r').read()
+
+for test in tests:
+    out_file = DIR + test + '.json'
+    print('Generating ' + out_file)
+    context = {
+       'title': test,
+       'query': "commit_info.project:soledad AND commit_info.branch='master' AND machine_info.host='weasel' AND name='" + test + "'"
+    }
+
+    rendered = pystache.render(template, context)
+    #print(context)
+
+    out = open(out_file, 'w')
+    out.write(rendered)
+    out.flush()
diff --git a/elastic/visualization/template.mustache b/elastic/visualization/template.mustache
new file mode 100644 (file)
index 0000000..d4c4bb8
--- /dev/null
@@ -0,0 +1,10 @@
+{
+"title": "{{{title}}}",
+"visState": "{\"title\":\"Soledad benchmark for {{{title}}}\",\"type\":\"line\",\"params\":{\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"showCircles\":true,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.min\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"commit_id_and_date\",\"size\":100,\"orderAgg\":{\"id\":\"2-orderAgg\",\"enabled\":true,\"type\":\"min\",\"schema\":\"orderAgg\",\"params\":{\"field\":\"commit_info.time\"}},\"order\":\"asc\",\"orderBy\":\"custom\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.mean\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.max\"}}],\"listeners\":{}}",
+  "uiStateJSON": "{}",
+  "description": "Soledad benchmark for {{{title}}}",
+  "version": 1,
+  "kibanaSavedObjectMeta": {
+  "searchSourceJSON": "{\"index\":\"benchmark*\",\"filter\":[],\"highlight\":{\"pre_tags\":[\"@kibana-highlighted-field@\"],\"post_tags\":[\"@/kibana-highlighted-field@\"],\"fields\":{\"*\":{}},\"require_field_match\":false,\"fragment_size\":2147483647},\"query\":{\"query_string\":{\"query\":\"{{{query}}}\",\"analyze_wildcard\":true}}}"
+  }
+}
diff --git a/elastic/visualization/test_upload_20_500k.json b/elastic/visualization/test_upload_20_500k.json
deleted file mode 100644 (file)
index cdd4624..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-  "title": "Upload 20x 500kb",
-  "visState": "{\"title\":\"Soledad upload 20x 500kb\",\"type\":\"line\",\"params\":{\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"showCircles\":true,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.min\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"commit_id_and_date\",\"size\":100,\"orderAgg\":{\"id\":\"2-orderAgg\",\"enabled\":true,\"type\":\"min\",\"schema\":\"orderAgg\",\"params\":{\"field\":\"commit_info.time\"}},\"order\":\"asc\",\"orderBy\":\"custom\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.mean\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"stats.max\"}}],\"listeners\":{}}",
-  "uiStateJSON": "{}",
-  "description": "Test from json upload",
-  "savedSearchId": "benchmark-master-branch-weasel",
-  "version": 1,
-  "kibanaSavedObjectMeta": {
-    "searchSourceJSON": "{\"filter\":[]}"
-  }
-}