From b9474e7fc331a76eead9fb6e9f4b9ad0fcaf5a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Tue, 22 May 2018 15:29:08 +0200 Subject: [PATCH] total_rows in copyto metrics --- app/controllers/copy_controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/copy_controller.js b/app/controllers/copy_controller.js index 915a18cc..c186fc73 100644 --- a/app/controllers/copy_controller.js +++ b/app/controllers/copy_controller.js @@ -74,7 +74,8 @@ function handleCopyTo (statsClient) { let metrics = { size: 0, time: null, - format: getFormatFromCopyQuery(req.query.sql) + format: getFormatFromCopyQuery(req.query.sql), + total_rows: null }; res.header("Content-Disposition", `attachment; filename=${encodeURIComponent(filename)}`); @@ -97,6 +98,7 @@ function handleCopyTo (statsClient) { .on('data', data => metrics.size += data.length) .on('end', () => { metrics.time = (Date.now() - startTime) / 1000; + metrics.total_rows = copyToStream.rowCount; statsClient.set('copyTo', JSON.stringify(metrics)); }) .pipe(res);