removing old metrics in copy
This commit is contained in:
parent
c62ef15dda
commit
8e8ccc9c67
@ -90,23 +90,15 @@ function handleCopyFrom (streamCopy) {
|
|||||||
res.locals.userDbParams,
|
res.locals.userDbParams,
|
||||||
res.locals.user,
|
res.locals.user,
|
||||||
req.get('content-encoding') === 'gzip',
|
req.get('content-encoding') === 'gzip',
|
||||||
function(err, metrics) { // TODO: remove when data-ingestion log works: {time, rows}
|
function(err, metrics) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove when data-ingestion log works
|
const { time, rows } = metrics;
|
||||||
const { time, rows, type, format, gzip, size } = metrics;
|
|
||||||
|
|
||||||
if (!time || !rows) {
|
if (!time || !rows) {
|
||||||
return next(new Error("No rows copied"));
|
return next(new Error("No rows copied"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove when data-ingestion log works
|
|
||||||
if (req.profiler) {
|
|
||||||
req.profiler.add({copyFrom: { type, format, gzip, size, rows, time }});
|
|
||||||
res.header('X-SQLAPI-Profiler', req.profiler.toJSONString());
|
|
||||||
}
|
|
||||||
|
|
||||||
res.send({
|
res.send({
|
||||||
time,
|
time,
|
||||||
|
@ -46,17 +46,6 @@ describe('copy-endpoints', function() {
|
|||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(!!response.time, true);
|
assert.equal(!!response.time, true);
|
||||||
assert.strictEqual(response.total_rows, 6);
|
assert.strictEqual(response.total_rows, 6);
|
||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-profiler']);
|
|
||||||
const headers = JSON.parse(res.headers['x-sqlapi-profiler']);
|
|
||||||
assert.ok(headers.copyFrom);
|
|
||||||
const metrics = headers.copyFrom;
|
|
||||||
assert.equal(metrics.size, 57);
|
|
||||||
assert.equal(metrics.format, 'CSV');
|
|
||||||
assert.equal(metrics.time, response.time);
|
|
||||||
assert.equal(metrics.rows, response.total_rows);
|
|
||||||
assert.equal(metrics.gzip, false);
|
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -175,17 +164,6 @@ describe('copy-endpoints', function() {
|
|||||||
const response = JSON.parse(res.body);
|
const response = JSON.parse(res.body);
|
||||||
assert.equal(!!response.time, true);
|
assert.equal(!!response.time, true);
|
||||||
assert.strictEqual(response.total_rows, 6);
|
assert.strictEqual(response.total_rows, 6);
|
||||||
|
|
||||||
assert.ok(res.headers['x-sqlapi-profiler']);
|
|
||||||
const headers = JSON.parse(res.headers['x-sqlapi-profiler']);
|
|
||||||
assert.ok(headers.copyFrom);
|
|
||||||
const metrics = headers.copyFrom;
|
|
||||||
assert.equal(metrics.size, 57);
|
|
||||||
assert.equal(metrics.format, 'CSV');
|
|
||||||
assert.equal(metrics.time, response.time);
|
|
||||||
assert.equal(metrics.rows, response.total_rows);
|
|
||||||
assert.equal(metrics.gzip, true);
|
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user