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.user,
|
||||
req.get('content-encoding') === 'gzip',
|
||||
function(err, metrics) { // TODO: remove when data-ingestion log works: {time, rows}
|
||||
function(err, metrics) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
// TODO: remove when data-ingestion log works
|
||||
const { time, rows, type, format, gzip, size } = metrics;
|
||||
|
||||
const { time, rows } = metrics;
|
||||
if (!time || !rows) {
|
||||
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({
|
||||
time,
|
||||
|
@ -46,17 +46,6 @@ describe('copy-endpoints', function() {
|
||||
const response = JSON.parse(res.body);
|
||||
assert.equal(!!response.time, true);
|
||||
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();
|
||||
});
|
||||
});
|
||||
@ -175,17 +164,6 @@ describe('copy-endpoints', function() {
|
||||
const response = JSON.parse(res.body);
|
||||
assert.equal(!!response.time, true);
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user