Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-45811: Additional thresholds in the query selectors on the Qserv Web Dashboard #864

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/admin/python/lsst/qserv/admin/replicationInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
self.repl_ctrl = urlparse(repl_ctrl_uri)
self.auth_key = auth_key
self.admin_auth_key = admin_auth_key
self.repl_api_version = 35
self.repl_api_version = 36
_log.debug(f"ReplicationInterface %s", self.repl_ctrl)

def version(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/http/ChttpMetaModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ string const adminAuthKey;

namespace lsst::qserv::http {

unsigned int const ChttpMetaModule::version = 35;
unsigned int const ChttpMetaModule::version = 36;

void ChttpMetaModule::process(string const& context, nlohmann::json const& info, httplib::Request const& req,
httplib::Response& resp, string const& subModuleName) {
Expand Down
2 changes: 1 addition & 1 deletion src/http/MetaModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ string const adminAuthKey;

namespace lsst::qserv::http {

unsigned int const MetaModule::version = 35;
unsigned int const MetaModule::version = 36;

void MetaModule::process(string const& context, nlohmann::json const& info,
shared_ptr<qhttp::Request> const& req, shared_ptr<qhttp::Response> const& resp,
Expand Down
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
4 changes: 2 additions & 2 deletions src/www/qserv/js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(sqlFormatter,
_) {

class Common {
static RestAPIVersion = 35;
static RestAPIVersion = 36;
static query2text(query, expanded) {
if (expanded) {
return sqlFormatter.format(query, Common._sqlFormatterConfig);
Expand All @@ -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
13 changes: 8 additions & 5 deletions src/www/qserv/js/QservCzarQueryProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ function(CSSLoader,

class QservCzarQueryProgress extends FwkApplication {

// Return the default number of the last seconds to track in the query history
static last_seconds() { return 15 * 60; }

constructor(name) {
super(name);
this._data = undefined;
Expand Down Expand Up @@ -97,8 +100,8 @@ function(CSSLoader,
data-placement="top">
<label for="horizontal-scale">Horizontal scale:</label>
<select id="horizontal-scale" class="form-control form-control-viewer">
<option selected value="">&nbsp;</option>
<option value="auto-zoom-in">auto-zoom-in</option>
<option value="">&nbsp;</option>
<option selected value="auto-zoom-in">auto-zoom-in</option>
</select>
</div>
<div class="form-group col-md">
Expand Down Expand Up @@ -126,7 +129,7 @@ function(CSSLoader,
`;
let cont = this.fwk_app_container.html(html);
cont.find('[data-toggle="tooltip"]').tooltip();
this._set_last_seconds(900);
this._set_last_seconds(QservCzarQueryProgress.last_seconds());
cont.find(".form-control-selector").change(() => {
this._load();
});
Expand All @@ -137,9 +140,9 @@ function(CSSLoader,
cont.find("button#reset-form").click(() => {
this._set_update_interval_sec(10);
this._set_query_id(0);
this._set_last_seconds(15 * 60);
this._set_last_seconds(QservCzarQueryProgress.last_seconds());
this._set_vertical_scale('logarithmic');
this._set_horizontal_scale('');
this._set_horizontal_scale('auto-zoom-in');
this._load();
});
}
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
Loading