Skip to content

Commit

Permalink
πŸ› Collect debugging information as expected error (#30055)
Browse files Browse the repository at this point in the history
* collect log use expectedError

* throttle by another 10%
  • Loading branch information
zhouyx committed Aug 31, 2020
1 parent 2778b5e commit 91f00c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions extensions/amp-analytics/0.1/requests.js
Expand Up @@ -566,11 +566,15 @@ function reportErrorTemp(url, info) {
}
const elementSize = queryString['d'] && queryString['d'].split(',');
const viewportSize = queryString['bs'] && queryString['bs'].split(',');
const REPORTING_THRESHOLD = 0.1;
if (isArray(elementSize)) {
const elementWidth = Number(elementSize[0]);
const elementHeight = Number(elementSize[1]);
if (elementWidth == 0 || elementHeight == 0) {
dev().error(
if (Math.random() > REPORTING_THRESHOLD) {
return;
}
dev().expectedError(
GOOGLE_ACTIVEVIEW_ERROR_TAG,
'Debugging: Activeview request with zero element size',
elementWidth,
Expand All @@ -585,7 +589,10 @@ function reportErrorTemp(url, info) {
const viewportHeight = Number(viewportSize[1]);

if (viewportWidth == 0 || viewportHeight == 0) {
dev().error(
if (Math.random() > REPORTING_THRESHOLD) {
return;
}
dev().expectedError(
GOOGLE_ACTIVEVIEW_ERROR_TAG,
'Debugging: Activeview request with zero viewport size',
viewportWidth,
Expand Down

0 comments on commit 91f00c2

Please sign in to comment.