Skip to content

Commit

Permalink
Extended past query search criterias in Dashboard and REST API of the…
Browse files Browse the repository at this point in the history
… Controller
  • Loading branch information
iagaponenko committed Oct 3, 2024
1 parent 66a98e8 commit 6a5efd9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 18 deletions.
20 changes: 19 additions & 1 deletion src/replica/contr/HttpQservMonitorModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,16 @@ json HttpQservMonitorModule::_activeQueriesProgress() {

json HttpQservMonitorModule::_pastQueries() {
debug(__func__);
checkApiVersion(__func__, 25);
checkApiVersion(__func__, 36);

auto const config = controller()->serviceProvider()->config();
string const queryStatus = query().optionalString("query_status", string());
string const queryType = query().optionalString("query_type", string());
unsigned int const queryAgeSec = query().optionalUInt("query_age", 0);
unsigned int const minElapsedSec = query().optionalUInt("min_elapsed_sec", 0);
unsigned int const minNumChunks = query().optionalUInt("min_num_chunks", 0);
unsigned int const minCollectedBytes = query().optionalUInt("min_collected_bytes", 0);
unsigned int const minFinalRows = query().optionalUInt("min_final_rows", 0);
unsigned int const limit4past = query().optionalUInt("limit4past", 1);
string const searchPattern = query().optionalString("search_pattern", string());
bool const searchRegexpMode = query().optionalUInt("search_regexp_mode", 0) != 0;
Expand All @@ -529,6 +532,9 @@ json HttpQservMonitorModule::_pastQueries() {
debug(__func__, "query_type=" + queryType);
debug(__func__, "query_age=" + to_string(queryAgeSec));
debug(__func__, "min_elapsed_sec=" + to_string(minElapsedSec));
debug(__func__, "min_num_chunks=" + to_string(minNumChunks));
debug(__func__, "min_collected_bytes=" + to_string(minCollectedBytes));
debug(__func__, "min_final_rows=" + to_string(minFinalRows));
debug(__func__, "limit4past=" + to_string(limit4past));
debug(__func__, "search_pattern=" + searchPattern);
debug(__func__, "search_regexp_mode=" + bool2str(searchRegexpMode));
Expand Down Expand Up @@ -557,6 +563,18 @@ json HttpQservMonitorModule::_pastQueries() {
string const cond = g.gt(g.TIMESTAMPDIFF("SECOND", "submitted", "completed"), minElapsedSec);
g.packCond(constraints, cond);
}
if (minNumChunks > 0) {
string const cond = g.gt("chunkCount", minNumChunks);
g.packCond(constraints, cond);
}
if (minCollectedBytes > 0) {
string const cond = g.gt("collectedBytes", minCollectedBytes);
g.packCond(constraints, cond);
}
if (minFinalRows > 0) {
string const cond = g.gt("finalRows", minFinalRows);
g.packCond(constraints, cond);
}
if (!searchPattern.empty()) {
if (searchRegexpMode) {
g.packCond(constraints, g.regexp("query", searchPattern));
Expand Down
2 changes: 1 addition & 1 deletion src/www/qserv/js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function(sqlFormatter,
}
}
static _sqlFormatterConfig = {"language":"mysql", "uppercase:":true, "indent":" "};
static _max_compact_length = 120;
static _max_compact_length = 104;
static _ivals = [
{value: 2, name: '2 sec'},
{value: 5, name: '5 sec'},
Expand Down
60 changes: 44 additions & 16 deletions src/www/qserv/js/StatusPastQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function(CSSLoader,
let html = `
<div class="row" id="fwk-status-past-queries-controls">
<div class="col">
<h3>Search queries</h3>
<div class="form-row">
<div class="form-group col-md-2">
<label for="query-age">Submitted:</label>
Expand All @@ -89,6 +88,14 @@ function(CSSLoader,
<option value="604800">1 WEEK AGO</option>
</select>
</div>
<div class="form-group col-md-1">
<label for="query-type">Type:</label>
<select id="query-type" class="form-control form-control-selector">
<option value="" selected></option>
<option value="SYNC">SYNC</option>
<option value="ASYNC">ASYNC</option>
</select>
</div>
<div class="form-group col-md-1">
<label for="query-status">Status:</label>
<select id="query-status" class="form-control form-control-selector">
Expand All @@ -98,18 +105,6 @@ function(CSSLoader,
<option value="ABORTED">ABORTED</option>
</select>
</div>
<div class="form-group col-md-1">
<label for="min-elapsed">Min.elapsed [sec]:</label>
<input type="number" id="min-elapsed" class="form-control form-control-selector" value="0">
</div>
<div class="form-group col-md-1">
<label for="query-type">Type:</label>
<select id="query-type" class="form-control form-control-selector">
<option value="" selected></option>
<option value="SYNC">SYNC</option>
<option value="ASYNC">ASYNC</option>
</select>
</div>
<div class="form-group col-md-2">
<label for="query-search-pattern">Search pattern:</label>
<input type="text" id="query-search-pattern" class="form-control form-control-selector" value="">
Expand All @@ -121,6 +116,24 @@ function(CSSLoader,
<option value="REGEXP">REGEXP</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-1">
<label for="min-elapsed">Min.elapsed.sec:</label>
<input type="number" id="min-elapsed" class="form-control form-control-selector" value="0">
</div>
<div class="form-group col-md-1">
<label for="min-chunks">Min.chunks:</label>
<input type="number" id="min-chunks" class="form-control form-control-selector" value="0">
</div>
<div class="form-group col-md-1">
<label for="min-bytes">Min.bytes:</label>
<input type="number" id="min-bytes" class="form-control form-control-selector" value="0">
</div>
<div class="form-group col-md-1">
<label for="min-rows">Min.rows:</label>
<input type="number" id="min-rows" class="form-control form-control-selector" value="0">
</div>
<div class="form-group col-md-1">
<label for="max-queries">Max.queries:</label>
<select id="max-queries" class="form-control form-control-selector">
Expand Down Expand Up @@ -153,9 +166,9 @@ function(CSSLoader,
<thead class="thead-light">
<tr>
<th class="sticky">Submitted</th>
<th class="sticky">Type</th>
<th class="sticky">Status</th>
<th class="sticky" style="text-align:right;">Elapsed</th>
<th class="sticky">Type</th>
<th class="sticky" style="text-align:right;">Chunks</th>
<th class="sticky" style="text-align:right;">Ch/min</th>
<th class="sticky" style="text-align:right;">&sum;&nbsp;Bytes</th>
Expand All @@ -180,6 +193,9 @@ function(CSSLoader,
this._set_query_age("0");
this._set_query_status("");
this._set_min_elapsed("0");
this._set_min_chunks("0");
this._set_min_bytes("0");
this._set_min_rows("0");
this._set_query_type("");
this._set_query_search_pattern("");
this._set_query_search_mode("LIKE");
Expand Down Expand Up @@ -215,6 +231,15 @@ function(CSSLoader,
_get_min_elapsed() { return this._form_control('input', 'min-elapsed').val(); }
_set_min_elapsed(val) { this._form_control('input', 'min-elapsed').val(val); }

_get_min_chunks() { return this._form_control('input', 'min-chunks').val(); }
_set_min_chunks(val) { this._form_control('input', 'min-chunks').val(val); }

_get_min_bytes() { return this._form_control('input', 'min-bytes').val(); }
_set_min_bytes(val) { this._form_control('input', 'min-bytes').val(val); }

_get_min_rows() { return this._form_control('input', 'min-rows').val(); }
_set_min_rows(val) { this._form_control('input', 'min-rows').val(val); }

_get_query_type() { return this._form_control('select', 'query-type').val(); }
_set_query_type(val) { this._form_control('select', 'query-type').val(val); }

Expand Down Expand Up @@ -243,6 +268,9 @@ function(CSSLoader,
query_age: this._get_query_age(),
query_status: this._get_query_status(),
min_elapsed_sec: this._get_min_elapsed(),
min_num_chunks: this._get_min_chunks(),
min_collected_bytes: this._get_min_bytes(),
min_final_rows: this._get_min_rows(),
query_type: this._get_query_type(),
search_pattern: this._get_query_search_pattern(),
search_regexp_mode: this._get_query_search_mode() == "REGEXP" ? 1 : 0,
Expand Down Expand Up @@ -305,10 +333,10 @@ function(CSSLoader,
let expanded = (query.queryId in this._queryId2Expanded) && this._queryId2Expanded[query.queryId];
html += `
<tr class="${failed_query_class}" id="${query.queryId}">
<td style="padding-right:10px;"><pre>` + query.submitted + `</pre></td>
<td style="padding-right:10px;"><pre>${query.submitted}</pre></td>
<td><pre>${query.qType}</pre></td>
<td style="padding-right:10px;"><pre>${query.status}</pre></td>
<th style="text-align:right; padding-top:0;">${elapsed}</th>
<td><pre>` + query.qType + `</pre></td>
<th style="text-align:right;"><pre>${query.chunkCount}</pre></th>
<td style="text-align:right;" ><pre>${performance > 0 ? performance : ''}</pre></td>
<th style="text-align:right;"><pre>${query.collectedBytes}</pre></th>
Expand Down

0 comments on commit 6a5efd9

Please sign in to comment.