Commit 55c37b06 authored by Heinz N. Gies's avatar Heinz N. Gies

Add debug option and graphing

parent 52b192cd
......@@ -40,17 +40,27 @@
<button type="submit" class="button postfix">query</button>
</div>
</div>
<div class="row collapse">
<div class="small-10 columns">
</div>
<div class="small-2 columns">
<input id="debug" type="checkbox"/><label for="debug">Debug</label>
</div>
</div>
</form>
<div id="results"></div>
<div id="legend"></div>
<div id="events"></div>
<div id="graph"></div>
<div id="timewrap">
<p>Query completed in <span id="time"></span></p>
<p>Query completed in <span id="time"></span>.</p>
</div>
</div>
<script src="/js/vendor/modernizr.js"></script>
<script src="/js/vendor/viz.js"></script>
<script src="/js/vendor/jquery.js"></script>
<script src="/js/vendor/jquery.cookie.js"></script>
<script src="/js/vendor/fastclick.js"></script>
......
......@@ -65,8 +65,9 @@ if (QueryString.metric && QueryString.bucket) {
function render_metrics(start, metrics, markers) {
var data,
legend = [];
$("#results").text("");
if (metrics.length > 0) {
$("#events").append($("<h3></h3>").text("Metrics")).append($("<hr/>"))
$("#results").append($("<h3></h3>").text("Metrics")).append($("<hr/>"))
data = metrics.map(function(s) {
var resolution = s.resolution,
values = s.values,
......@@ -116,18 +117,30 @@ function render_event(event) {
$("#events").append(div)
}
function render_events(start, events) {
$("#events").text("");
if (events.length > 0) {
$("#events").append($("<h3></h3>").text("Events")).append($("<hr/>"))
events.map(render_event)
}
}
function render_graph(graph) {
$("#graph").text("")
if (graph) {
$("#graph").append($("<h3></h3>").text("Query graph")).append($("<pre/>").append(Viz(graph)))
}
}
function q() {
var query = $("#query").val();
var base = "?"
$("#events").text("").append($("<hr/>"))
msgpack.download("?q=" + query, {header: {accept:"application/x-msgpack"}}, function(res) {
console.log("Fetched " + res.results[0].values.length * res.results[0] + " elements in " +
res.query_time / 1000 + "ms");
if ($("#debug").is(':checked')) {
base = "?graph&q=";
} else {
base = "?q=";
}
msgpack.download(base + query, {header: {accept:"application/x-msgpack"}}, function(res) {
$("#permalink").attr("href", "/?query=" + encodeURIComponent(query));
$("#permalink").show();
$("#time").text((res.query_time / 1000) + "ms");
......@@ -140,11 +153,15 @@ function q() {
metrics = res.results.filter(function(e) {
return e.type == "metrics"
});
console.log(metrics[0])
console.log("Fetched " + metrics[0].values.length * metrics.length + " elements in " +
res.query_time / 1000 + "ms");
events = res.results.filter(function(e) {
return e.type == "events"
});
render_metrics(start, metrics, markers);
render_events(start, events);
render_graph(res.graph)
});
}
This diff is collapsed.
......@@ -63,7 +63,7 @@ encode_reply(Start, T, R2) ->
case R2 of
[#{type := graph,
value := Graph} | _] ->
maps:put(D, graph, Graph);
maps:put(graph, Graph, D);
_ ->
D
end.
......
......@@ -8,7 +8,7 @@
{<<"dproto">>,{pkg,<<"dproto">>,<<"0.2.2">>},1},
{<<"dqe">>,
{git,"https://github.com/dalmatinerdb/dqe.git",
{ref,"ceb5245620fd3206acc3a6611eb3d1dafebcc88f"}},
{ref,"139c641180335dd4d8015e3733a3a379cf6c9c92"}},
0},
{<<"dqe_fun">>,{pkg,<<"dqe_fun">>,<<"0.1.11">>},1},
{<<"dqe_idx">>,{pkg,<<"dqe_idx">>,<<"0.2.1">>},1},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment