From 372675b0ae377430405ebe452abd71d7eb5b8eac Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Wed, 13 Mar 2019 21:51:29 -0500 Subject: [PATCH] fix: more sensible stats logging --- bin/find-entities-to-label.js | 15 ++++++++++----- bin/merge-origins-with-entities.js | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/find-entities-to-label.js b/bin/find-entities-to-label.js index 6635a5d..a18b5da 100644 --- a/bin/find-entities-to-label.js +++ b/bin/find-entities-to-label.js @@ -118,7 +118,12 @@ function computeChangesSinceLast(currentDataset, lastDataset) { const currentDatasetStats = computeAllStats(CURRENT_DATASET) const lastDatasetStats = computeAllStats(LAST_DATASET) -const {top50Occurrences, homelessGrouped, totalEntityOccurrences} = currentDatasetStats +const { + sortedEntityData, + top50Occurrences, + homelessGrouped, + totalEntityOccurrences, +} = currentDatasetStats const changesSinceLast = computeChangesSinceLast(currentDatasetStats, lastDatasetStats) @@ -165,14 +170,14 @@ console.log( '% of total requests', ) console.log( - 'Entities representing', + `${sortedEntityData.length} Entities representing`, ((totalEntityOccurrences / THIRD_PARTY_REQUESTS) * 100).toFixed(2), - '% of 3rd parties', + '% of 3rd party requests', ) console.log( 'Top 50 Entities representing', - ((top50Occurrences / totalEntityOccurrences) * 100).toFixed(2), - '% of all entity requests', + ((top50Occurrences / THIRD_PARTY_REQUESTS) * 100).toFixed(2), + '% of 3rd party requests', ) console.log('Finished processing', datasetFiles[0]) diff --git a/bin/merge-origins-with-entities.js b/bin/merge-origins-with-entities.js index a6afbef..c8795f7 100644 --- a/bin/merge-origins-with-entities.js +++ b/bin/merge-origins-with-entities.js @@ -185,14 +185,14 @@ console.log( '% of total script execution', ) console.log( - 'Entities representing', + `${sortedEntityData.length} Entities representing`, ((totalEntityExecutionTime / THIRD_PARTY_EXECUTION_TIME) * 100).toFixed(2), - '% of 3rd parties', + '% of 3rd party script execution', ) console.log( 'Top 50 Entities representing', - ((top50ExecutionTime / totalEntityExecutionTime) * 100).toFixed(2), - '% of total entity execution', + ((top50ExecutionTime / THIRD_PARTY_EXECUTION_TIME) * 100).toFixed(2), + '% of 3rd party script execution', ) fs.writeFileSync(