fix: add cdb-user field to data ingestion and batch queries logs

remotes/origin/dependabot/npm_and_yarn/redis-3.1.1
Daniel García Aubert 4 years ago
parent 5cedad09c1
commit 53f69dd6e4

@ -102,10 +102,10 @@ function handleCopyTo ({ logger: mainLogger }) {
const pid = streamCopy.clientProcessID;
streamCopy.cancel(pid, StreamCopy.ACTION_TO, (err) => {
if (err) {
return mainLogger.error({ request_id: requestId, exception: err, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Unable to cancel stream query');
return mainLogger.error({ 'cdb-user': user, request_id: requestId, exception: err, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Unable to cancel stream query');
}
mainLogger.info({ request_id: requestId, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Canceled stream query successfully');
mainLogger.info({ 'cdb-user': user, request_id: requestId, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Canceled stream query successfully');
});
return next(err);

@ -140,7 +140,7 @@ function createJob (jobService) {
return next(err);
}
logger.info({ job: job.toJSON() }, 'Batch query job created');
logger.info({ 'cdb-user': res.locals.user, job: job.toJSON() }, 'Batch query job created');
res.statusCode = 201;
res.body = job.serialize();

@ -116,9 +116,9 @@ Batch.prototype.processJob = function (user, callback) {
}
if (JobStatus.isFinal(job.data.status)) {
self.logger.info({ job: job.toJSON() }, 'Batch query job finished');
self.logger.info({ 'cdb-user': user, job: job.toJSON() }, 'Batch query job finished');
} else {
self.logger.debug({ job: job.toJSON() }, 'Batch query job: query done');
self.logger.debug({ 'cdb-user': user, job: job.toJSON() }, 'Batch query job: query done');
}
return callback(null, !EMPTY_QUEUE);

@ -82,6 +82,6 @@ module.exports = class StreamCopyMetrics {
logData.success = this.success;
this.logger.info({ ingestion: logData }, 'Copy to/from query metrics');
this.logger.info({ 'cdb-user': this.username, ingestion: logData }, 'Copy to/from query metrics');
}
};

Loading…
Cancel
Save