Skip to content

Commit

Permalink
Tag unknown third party requests (so you can keep track of them) (#2405)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Apr 1, 2019
1 parent de86528 commit 4aa8217
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/plugins/html/templates/url/thirdparty/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ if thirdparty.category && Object.keys(thirdparty.category).length > 0
table(data-sortable, id='thirdPartyTools')
+rowHeading(['Category', 'Number of tools'])
each metric, category in thirdparty.category
tr
td(data-title='Category') #{category}
+numberCell('Tools', metric.tools ? metric.tools.median : Object.keys(thirdparty.toolsByCategory[category]).length)
if (category !== 'unknown')
tr
td(data-title='Category') #{category}
+numberCell('Tools', metric.tools ? metric.tools.median :Object.keys(thirdparty.toolsByCategory[category]).length)

if thirdparty.assets && Object.keys(thirdparty.assets).length > 0
h3 Third party requests and tools
Expand Down
7 changes: 6 additions & 1 deletion lib/plugins/thirdparty/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
}
}
}
const byCategory = {};
const byCategory = { unknown: 0 };
this.groups[message.url] = message.group;
for (let asset of message.data.assets) {
const entity = getEntity(asset.url);
Expand Down Expand Up @@ -73,6 +73,11 @@ module.exports = {
}
toolsByCategory[category][entity.name] = 1;
}
} else {
// We don't have a match for this request, check agains the regex
if (!asset.url.match(firstPartyRegEx)) {
byCategory['unknown'] = byCategory['unknown'] + 1;
}
}
}
aggregator.addToAggregate(message.url, byCategory, toolsByCategory);
Expand Down

0 comments on commit 4aa8217

Please sign in to comment.