rename gzip to isGzip
This commit is contained in:
parent
87fd9db1fe
commit
4fab96cb3a
@ -133,9 +133,9 @@ function handleCopyFrom (logger) {
|
||||
return function handleCopyFromMiddleware (req, res, next) {
|
||||
const sql = req.query.q;
|
||||
const { userDbParams, user } = res.locals;
|
||||
const gzip = req.get('content-encoding') === 'gzip';
|
||||
const isGzip = req.get('content-encoding') === 'gzip';
|
||||
|
||||
let metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, user, gzip);
|
||||
let metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, user, isGzip);
|
||||
|
||||
streamCopy.from(
|
||||
sql,
|
||||
@ -172,7 +172,7 @@ function handleCopyFrom (logger) {
|
||||
}
|
||||
})
|
||||
.on('data', data => {
|
||||
if (gzip) {
|
||||
if (isGzip) {
|
||||
metrics.addGzipSize(data.length);
|
||||
} else {
|
||||
metrics.addSize(data.length);
|
||||
@ -181,7 +181,7 @@ function handleCopyFrom (logger) {
|
||||
.on('end', () => requestEnded = true);
|
||||
|
||||
|
||||
if (gzip) {
|
||||
if (isGzip) {
|
||||
req
|
||||
.pipe(zlib.createGunzip())
|
||||
.on('data', data => metrics.addSize(data.length))
|
||||
|
@ -1,12 +1,12 @@
|
||||
const { getFormatFromCopyQuery } = require('../utils/query_info');
|
||||
|
||||
module.exports = class StreamCopyMetrics {
|
||||
constructor(logger, type, sql, user, gzip = null) {
|
||||
constructor(logger, type, sql, user, isGzip = null) {
|
||||
this.logger = logger;
|
||||
|
||||
this.type = type;
|
||||
this.format = getFormatFromCopyQuery(sql);
|
||||
this.gzip = gzip;
|
||||
this.isGzip = isGzip;
|
||||
this.username = user;
|
||||
this.size = 0;
|
||||
this.gzipSize = 0;
|
||||
@ -49,7 +49,7 @@ module.exports = class StreamCopyMetrics {
|
||||
|
||||
this._log(
|
||||
this.startTime.toISOString(),
|
||||
this.gzip && this.gzipSize ? this.gzipSize : null,
|
||||
this.isGzip && this.gzipSize ? this.gzipSize : null,
|
||||
this.error ? this.error.message : null
|
||||
);
|
||||
}
|
||||
@ -60,7 +60,7 @@ module.exports = class StreamCopyMetrics {
|
||||
format: this.format,
|
||||
size: this.size,
|
||||
rows: this.rows,
|
||||
gzip: this.gzip,
|
||||
gzip: this.isGzip,
|
||||
username: this.username,
|
||||
time: this.time,
|
||||
timestamp
|
||||
|
Loading…
Reference in New Issue
Block a user