Always log queries from fallback jobs
- Add query id if exists - Only log analyses for expected format - Log with query start and end times
This commit is contained in:
parent
ba34412ce3
commit
20573a7f67
@ -220,20 +220,27 @@ JobFallback.prototype.log = function(logger) {
|
||||
for (var i = 0; i < queries.length; i++) {
|
||||
var query = queries[i];
|
||||
|
||||
if (!query.id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var node = parseQueryId(query.id);
|
||||
var output = {
|
||||
time: query.started_at,
|
||||
endtime: query.ended_at,
|
||||
username: this.data.user,
|
||||
job: this.data.job_id,
|
||||
analysis: node.analysis,
|
||||
node: node.id,
|
||||
type: node.type,
|
||||
elapsedTime: calculateElpasedTime(query.started_at, query.ended_at)
|
||||
};
|
||||
|
||||
var queryId = query.id;
|
||||
|
||||
if (queryId) {
|
||||
output.query_id = queryId;
|
||||
|
||||
var node = parseQueryId(queryId);
|
||||
if (node) {
|
||||
output.analysis = node.analysisId;
|
||||
output.node = node.nodeId;
|
||||
output.type = node.nodeType;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(output);
|
||||
}
|
||||
|
||||
@ -248,12 +255,15 @@ function isFinished (job) {
|
||||
function parseQueryId (queryId) {
|
||||
var data = queryId.split(':');
|
||||
|
||||
if (data.length === 3) {
|
||||
return {
|
||||
analysis: data[0],
|
||||
id: data[1],
|
||||
type: data[2]
|
||||
analysisId: data[0],
|
||||
nodeId: data[1],
|
||||
nodeType: data[2]
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function calculateElpasedTime (started_at, ended_at) {
|
||||
if (!started_at || !ended_at) {
|
||||
|
Loading…
Reference in New Issue
Block a user