Skip to content

Commit

Permalink
fix: more sensible stats logging
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Mar 14, 2019
1 parent 37b69df commit 372675b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 10 additions & 5 deletions bin/find-entities-to-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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])
8 changes: 4 additions & 4 deletions bin/merge-origins-with-entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 372675b

Please sign in to comment.