-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Silvano Ravotto
committed
Mar 2, 2021
1 parent
c871334
commit 4533320
Showing
12 changed files
with
891 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
samples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import module namespace qputils = "http://marklogic.com/optic/qputils" at "../lib/qputils.xqy"; | ||
|
||
xdmp:set-response-content-type("application/json"), | ||
let $file := xdmp:get-request-field("file") | ||
let $id := xdmp:get-request-field("id") | ||
let $type := xdmp:get-request-field("type", "estimate") | ||
|
||
|
||
let $id := "sessionKey=" || $id || " " | ||
|
||
let $regex := switch ($type) | ||
case "estimate" return ("Event:id=Optic Plan Trace" || ".*" || $id || "plan=") | ||
case "execution" return ("Event:id=Optic Execution Diagnostics Trace" || ".*" || $id ) | ||
case "optimization" return ("Optic Optimization Trace"|| ".*" || $id ) | ||
default return fn:error("QV-ARG", "Invalid type") | ||
|
||
|
||
let $res := xdmp:logfile-scan($file, $regex) | ||
let $res := if ($type = ("optimization")) | ||
then qputils:parseOptimization ($res ! fn:substring-after(., $id)) | ||
else qputils:makeGraph(xdmp:unquote(fn:substring-after($res, "
"))/*,"N") | ||
|
||
|
||
return json:to-array($res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
xdmp:set-response-content-type("application/json"), | ||
|
||
array-node { | ||
let $file := xdmp:get-request-field("file") | ||
let $trace := xdmp:get-request-field("trace") | ||
let $regex := xdmp:get-request-field("regex", "( plan=| diagnostic_plan=)") | ||
let $regex := | ||
if ($trace) | ||
then ("trace=" || $trace || ".*" || $regex ) | ||
else $regex | ||
let $start := xdmp:get-request-field("start") | ||
let $start := | ||
if ($start) | ||
then xs:dateTime (fn:substring(xdmp:logfile-scan($file, (), (), (), (), 1),1,10) || "T" || $start) | ||
else () | ||
let $end := () | ||
let $limit := 20 | ||
for $e in xdmp:logfile-scan($file, $regex, "s", $start, $end, $limit) | ||
let $type := if (fn:contains($e, "diagnostic_plan")) then "execution" else "estimate" | ||
let $trace := | ||
if (fn:contains($e, "trace=")) | ||
then fn:substring-before(fn:substring-after($e, " trace="), " sessionKey=") | ||
else "" | ||
let $key := | ||
if ($type eq "estimate") | ||
then fn:substring-before(fn:substring-after($e, " sessionKey="), " plan=") | ||
else fn:substring-before(fn:substring-after($e, " sessionKey="), " diagnostic_plan=") | ||
let $time := fn:substring($e, 1, 23) | ||
return | ||
object-node { "time" : $time, "key" : $key, "trace": $trace } | ||
|
||
} | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<html> | ||
|
||
<head> | ||
<script type="text/javascript" src="ui/lib/d3.v6.min.js">< !-- --></script> | ||
<script type="text/javascript" src="ui/qv.js">< !-- --></script> | ||
<link rel="stylesheet" href="ui/css/w3-theme.css"><!-- --> | ||
<link rel="stylesheet" href="ui/css/w3.css"><!-- --> | ||
<link rel="stylesheet" href="ui/css/style.css"><!-- --> | ||
</link> | ||
|
||
<meta charset="UTF-8"> | ||
|
||
|
||
</head> | ||
|
||
<body> | ||
<div id="wrapper" class="w3-container w3-theme-l6 full-height" > | ||
<div class="w3-col w3-theme-l1 full-height" style="width:200px"> | ||
<div id="form" class="w3-row"> | ||
<form class="w3-container w3-tiny"> | ||
<label>File</label> | ||
<input class="w3-input w3-border-0" type="text" name="file" id="form_file" | ||
value=""> | ||
<label>Start time</label> | ||
<input class="w3-input w3-border-0" type="text" name="start" id="form_start"> | ||
<label>Trace id</label> | ||
<input class="w3-input w3-border-0" type="text" name="trace" id="form_trace"> | ||
<div class="w3-padding-16 w3-center" > | ||
<button type="button" class="w3-button w3-round-large w3-theme-action" | ||
onclick="qv_scanLogForPlans('#plans','#form_file','#form_start', '#form_trace', '#viewer')">Load | ||
Plans | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
<div id="plans" class="w3-row"> | ||
<!-- --> | ||
</div> | ||
|
||
</div> | ||
<div class="w3-rest"> | ||
|
||
<div id="viewer"> | ||
<div id="tabs" class="qv-tabs w3-row w3-theme-l1"> | ||
<!-- --> | ||
</div> | ||
<div id="tooltip" class="tooltip"> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
xdmp:set-response-content-type("text/html"), | ||
|
||
let $dir := xdmp:modules-root() || "samples/" | ||
return | ||
element html { | ||
element body { | ||
element h2 { "Samples" }, | ||
for $group in xdmp:filesystem-directory ($dir)/dir:entry | ||
let $entries := xdmp:filesystem-directory($group/dir:pathname)/dir:entry[fn:ends-with(./dir:filename, ".xml")] | ||
return | ||
( | ||
element h3 { $group/dir:filename}, | ||
element table { | ||
attribute id {"box-table-a"}, | ||
for $entry in $entries | ||
order by $entry/dir:filename | ||
return | ||
element tr { | ||
element td { | ||
element a { attribute href {"show.xqy?filename=" || $entry/dir:pathname} , | ||
$entry/dir:filename/fn:string(.) | ||
} | ||
} | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.w3-theme-l5 {color:#000 !important; background-color:#fbfdfe !important} | ||
.w3-theme-l4 {color:#000 !important; background-color:#f3f8fc !important} | ||
.w3-theme-l3 {color:#000 !important; background-color:#e6f1f9 !important} | ||
.w3-theme-l2 {color:#000 !important; background-color:#dae9f6 !important} | ||
.w3-theme-l1 {color:#000 !important; background-color:#cee2f3 !important} | ||
.w3-theme-d1 {color:#000 !important; background-color:#9fc7e8 !important} | ||
.w3-theme-d2 {color:#000 !important; background-color:#7cb2df !important} | ||
.w3-theme-d3 {color:#fff !important; background-color:#599ed7 !important} | ||
.w3-theme-d4 {color:#fff !important; background-color:#368ace !important} | ||
.w3-theme-d5 {color:#fff !important; background-color:#2a73ae !important} | ||
|
||
.w3-theme-light {color:#000 !important; background-color:#fbfdfe !important} | ||
.w3-theme-dark {color:#fff !important; background-color:#2a73ae !important} | ||
.w3-theme-action {color:#fff !important; background-color:#2a73ae !important} | ||
|
||
.w3-theme {color:#000 !important; background-color:#c2dbf0 !important} | ||
.w3-text-theme {color:#c2dbf0 !important} | ||
.w3-border-theme {border-color:#c2dbf0 !important} | ||
|
||
.w3-hover-theme:hover {color:#000 !important; background-color:#c2dbf0 !important} | ||
.w3-hover-text-theme:hover {color:#c2dbf0 !important} | ||
.w3-hover-border-theme:hover {border-color:#c2dbf0 !important} |
Oops, something went wrong.