[elastic] create one dashboard per test
authordrebs <drebs@riseup.net>
Fri, 7 Jul 2017 21:54:31 +0000 (18:54 -0300)
committerdrebs <drebs@riseup.net>
Fri, 7 Jul 2017 21:54:31 +0000 (18:54 -0300)
elastic/generate-config.py
elastic/templates/dashboard-per-test.mustache [new file with mode: 0644]
elastic/templates/visualization-visState-time.mustache

index ec1a5e9..6facbd2 100755 (executable)
@@ -83,7 +83,7 @@ def generate_visualizations(tests):
                 out.write(rendered)
 
 
-def generate_dashboards(tests):
+def _dashboard_for_all_tests(tests):
     with open(os.path.join('templates', 'dashboard.mustache'), 'r') as f:
         template = f.read()
 
@@ -118,6 +118,22 @@ def generate_dashboards(tests):
         f.write(rendered)
 
 
+def _dashboard_for_one_test(test):
+    with open(os.path.join('templates', 'dashboard-per-test.mustache'), 'r') as f:
+        template = f.read()
+    context = {'test_name': test}
+    rendered = pystache.render(template, context)
+    out_file = os.path.join('dashboard', 'dashboard-%s.json' % test)
+    with open(out_file, 'w') as out:
+        out.write(rendered)
+
+
+def generate_dashboards(tests):
+    _dashboard_for_all_tests(tests)
+    for test in tests:
+        _dashboard_for_one_test(test)
+
+
 def _get_test_names():
     with open('./query/test_names.json') as f:
         response = requests.get(URL + '/_search', data=f)
diff --git a/elastic/templates/dashboard-per-test.mustache b/elastic/templates/dashboard-per-test.mustache
new file mode 100644 (file)
index 0000000..d9b8b52
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "title": "Benchmarks for {{{test_name}}}",
+  "hits": 0,
+  "description": "All Soledad benchmak tests run on Weasel",
+  "panelsJSON": "[{\"size_x\":6,\"size_y\":3,\"panelIndex\":1,\"type\":\"visualization\",\"id\":\"{{{test_name}}}_time\",\"col\":1,\"row\":1},{\"size_x\":6,\"size_y\":3,\"panelIndex\":2,\"type\":\"visualization\",\"id\":\"{{{test_name}}}_resources\",\"col\":7,\"row\":1}]",
+  "optionsJSON": "{\"darkTheme\":true}",
+  "uiStateJSON": "{}",
+  "version": 1,
+  "timeRestore": true,
+  "timeTo": "now",
+  "timeFrom": "now/y",
+  "refreshInterval": {
+    "display": "Off",
+    "pause": false,
+    "value": 0
+  },
+  "kibanaSavedObjectMeta": {
+    "searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
+  }
+}
index 5141ce0..7156a94 100644 (file)
 {
-   "type" : "line",
-   "aggs" : [
+  "title": "Time taken by {{{test_name}}}",
+  "type": "line",
+  "params": {
+    "addLegend": true,
+    "addTimeMarker": false,
+    "addTooltip": true,
+    "categoryAxes": [
       {
-         "type" : "avg",
-         "schema" : "metric",
-         "params" : {
-            "field" : "stats.median",
-            "customLabel" : "Median (s)"
-         },
-         "id" : "1",
-         "enabled" : true
-      },
+        "id": "CategoryAxis-1",
+        "labels": {
+          "show": true,
+          "truncate": 100
+        },
+        "position": "bottom",
+        "scale": {
+          "type": "linear"
+        },
+        "show": false,
+        "style": {},
+        "title": {
+          "text": "Commit info: id and date"
+        },
+        "type": "category"
+      }
+    ],
+    "defaultYExtents": false,
+    "drawLinesBetweenPoints": true,
+    "grid": {
+      "categoryLines": false,
+      "style": {
+        "color": "#eee"
+      }
+    },
+    "interpolate": "linear",
+    "legendPosition": "right",
+    "radiusRatio": 9,
+    "scale": "linear",
+    "seriesParams": [
       {
-         "type" : "terms",
-         "schema" : "segment",
-         "params" : {
-            "size" : 1000,
-            "orderAgg" : {
-               "enabled" : true,
-               "type" : "min",
-               "params" : {
-                  "field" : "commit_info.time"
-               },
-               "schema" : "orderAgg",
-               "id" : "2-orderAgg"
-            },
-            "field" : "commit_id_and_date",
-            "orderBy" : "custom",
-            "customLabel" : "Commit info: id and date",
-            "order" : "asc"
-         },
-         "id" : "2",
-         "enabled" : true
+        "data": {
+          "id": "3",
+          "label": "Mean (s)"
+        },
+        "drawLinesBetweenPoints": true,
+        "interpolate": "linear",
+        "lineWidth": 2,
+        "mode": "normal",
+        "show": true,
+        "showCircles": true,
+        "type": "line",
+        "valueAxis": "ValueAxis-1"
       },
       {
-         "schema" : "metric",
-         "params" : {
-            "field" : "stats.mean",
-            "customLabel" : "Mean (s)"
-         },
-         "id" : "3",
-         "type" : "avg",
-         "enabled" : true
+        "show": true,
+        "mode": "normal",
+        "type": "line",
+        "drawLinesBetweenPoints": true,
+        "showCircles": false,
+        "interpolate": "linear",
+        "lineWidth": 1,
+        "data": {
+          "id": "6",
+          "label": "Mean - Std. Dev. (s)"
+        },
+        "valueAxis": "ValueAxis-1"
       },
       {
-         "id" : "4",
-         "params" : {
-            "field" : "stats.iqr",
-            "customLabel" : "IQR (s)"
-         },
-         "schema" : "metric",
-         "type" : "avg",
-         "enabled" : true
-      },
+        "show": true,
+        "mode": "normal",
+        "type": "line",
+        "drawLinesBetweenPoints": true,
+        "showCircles": false,
+        "interpolate": "linear",
+        "lineWidth": 1,
+        "data": {
+          "id": "7",
+          "label": "Mean + Std. Dev. (s)"
+        },
+        "valueAxis": "ValueAxis-1"
+      }
+    ],
+    "setYExtents": false,
+    "showCircles": true,
+    "times": [],
+    "valueAxes": [
       {
-         "params" : {
-            "field" : "stats.stddev",
-            "customLabel" : "Standard deviation (s)"
-         },
-         "schema" : "metric",
-         "id" : "5",
-         "type" : "avg",
-         "enabled" : true
+        "id": "ValueAxis-1",
+        "labels": {
+          "filter": false,
+          "rotate": 0,
+          "show": true,
+          "truncate": 100
+        },
+        "name": "LeftAxis-1",
+        "position": "left",
+        "scale": {
+          "mode": "normal",
+          "type": "linear"
+        },
+        "show": true,
+        "style": {},
+        "title": {
+          "text": ""
+        },
+        "type": "value"
       }
-   ],
-   "params" : {
-      "legendPosition" : "right",
-      "drawLinesBetweenPoints" : true,
-      "times" : [],
-      "addTimeMarker" : false,
-      "showCircles" : true,
-      "scale" : "linear",
-      "addLegend" : true,
-      "defaultYExtents" : false,
-      "radiusRatio" : 9,
-      "interpolate" : "linear",
-      "seriesParams" : [
-         {
-            "interpolate" : "linear",
-            "show" : true,
-            "drawLinesBetweenPoints" : true,
-            "valueAxis" : "ValueAxis-1",
-            "mode" : "normal",
-            "type" : "line",
-            "lineWidth" : 2,
-            "showCircles" : true,
-            "data" : {
-               "id" : "1",
-               "label" : "Median (s)"
-            }
-         },
-         {
-            "drawLinesBetweenPoints" : true,
-            "interpolate" : "linear",
-            "show" : true,
-            "data" : {
-               "label" : "Mean (s)",
-               "id" : "3"
-            },
-            "showCircles" : true,
-            "valueAxis" : "ValueAxis-1",
-            "mode" : "normal",
-            "type" : "line",
-            "lineWidth" : 2
-         },
-         {
-            "show" : true,
-            "interpolate" : "linear",
-            "drawLinesBetweenPoints" : true,
-            "type" : "line",
-            "lineWidth" : 2,
-            "valueAxis" : "ValueAxis-1",
-            "mode" : "normal",
-            "data" : {
-               "id" : "4",
-               "label" : "IQR (s)"
-            },
-            "showCircles" : true
-         },
-         {
-            "type" : "line",
-            "lineWidth" : 2,
-            "valueAxis" : "ValueAxis-1",
-            "mode" : "normal",
-            "showCircles" : true,
-            "data" : {
-               "id" : "5",
-               "label" : "Standard deviation (s)"
-            },
-            "show" : true,
-            "interpolate" : "linear",
-            "drawLinesBetweenPoints" : true
-         }
-      ],
-      "setYExtents" : false,
-      "grid" : {
-         "style" : {
-            "color" : "#eee"
-         },
-         "categoryLines" : false
-      },
-      "addTooltip" : true,
-      "categoryAxes" : [
-         {
-            "scale" : {
-               "type" : "linear"
-            },
-            "title" : {
-               "text" : "Commit info: id and date"
-            },
-            "style" : {},
-            "type" : "category",
-            "id" : "CategoryAxis-1",
-            "position" : "bottom",
-            "labels" : {
-               "truncate" : 100,
-               "show" : true
-            },
-            "show" : false
-         }
-      ],
-      "valueAxes" : [
-         {
-            "title" : {
-               "text" : ""
-            },
-            "scale" : {
-               "mode" : "normal",
-               "type" : "linear"
-            },
-            "style" : {},
-            "type" : "value",
-            "id" : "ValueAxis-1",
-            "position" : "left",
-            "labels" : {
-               "filter" : false,
-               "rotate" : 0,
-               "truncate" : 100,
-               "show" : true
-            },
-            "show" : true,
-            "name" : "LeftAxis-1"
-         }
-      ]
-   },
-   "title" : "Time taken by {{{test_name}}}",
-   "listeners" : {}
+    ]
+  },
+  "aggs": [
+    {
+      "id": "2",
+      "enabled": true,
+      "type": "terms",
+      "schema": "segment",
+      "params": {
+        "field": "commit_id_and_date",
+        "size": 1000,
+        "orderAgg": {
+          "id": "2-orderAgg",
+          "enabled": true,
+          "type": "min",
+          "schema": "orderAgg",
+          "params": {
+            "field": "commit_info.time"
+          }
+        },
+        "order": "asc",
+        "orderBy": "custom",
+        "customLabel": "Commit info: id and date"
+      }
+    },
+    {
+      "id": "3",
+      "enabled": true,
+      "type": "avg",
+      "schema": "metric",
+      "params": {
+        "field": "stats.mean",
+        "customLabel": "Mean (s)"
+      }
+    },
+    {
+      "id": "6",
+      "enabled": true,
+      "type": "avg",
+      "schema": "metric",
+      "params": {
+        "field": "mean_minus_stddev",
+        "customLabel": "Mean - Std. Dev. (s)"
+      }
+    },
+    {
+      "id": "7",
+      "enabled": true,
+      "type": "avg",
+      "schema": "metric",
+      "params": {
+        "field": "mean_plus_stdev",
+        "customLabel": "Mean + Std. Dev. (s)"
+      }
+    }
+  ],
+  "listeners": {}
 }