-
Notifications
You must be signed in to change notification settings - Fork 4k
Send 1% sampled RTC error pings #14563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (isObject(urlObj)) { | ||
url = urlObj['url']; | ||
errorReportingUrl = urlObj['errorReportingUrl']; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else if (typeof urlObj == 'string') url = urlObj;
else /* warn and ignore */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}; | ||
Services.urlReplacementsForDoc(ampDoc).expandUrlAsync( | ||
errorReportingUrl, macros, whitelist).then(url => { | ||
Services.xhrFor(win).fetch(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to send as an XHR? I was thinking we would use an image (see https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/0.1/transport.js#L66)
ERROR_TYPE: errorType, | ||
HREF: win.location.href | ||
}; | ||
Services.urlReplacementsForDoc(ampDoc).expandUrlAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use expandUrlSync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
* @param {!Window} win | ||
*/ | ||
function sendErrorMessage(errorType, errorReportingUrl, win, ampDoc) { | ||
if (Math.random() < RTC_ERROR_REPORTING_FREQUENCY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this determined per page instead of per error report? Put the following as a static field:
const ERROR_REPORTING_ENABLED = Math.random() < 0.01;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
131b2c4
to
ff78db5
Compare
examples/doubleclick-rtc.amp.html
Outdated
@@ -17,7 +17,7 @@ | |||
<body> | |||
<h2> NOTE: Must disable check that isSecureUrl for testing </h2> | |||
<h2>Doubleclick with RTC</h2> | |||
<amp-ad width="320" height="50" | |||
<!-- <amp-ad width="320" height="50" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -32,6 +34,9 @@ const MAX_RTC_CALLOUTS = 5; | |||
/** @type {number} */ | |||
const MAX_URL_LENGTH = 16384; | |||
|
|||
/** @type {boolean} */ | |||
export const ERROR_REPORTING_ENABLED = Math.random() < 0.01; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why export?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -511,12 +513,14 @@ describes.realWin('real-time-config-manager', {amp: true}, env => { | |||
|
|||
// Test various misconfigurations that are missing vendors or urls. | |||
[{'timeoutMillis': 500}, {'vendors': {}}, {'urls': []}, | |||
{'vendors': {}, 'urls': []}, | |||
{'vendors': 'incorrect', 'urls': 'incorrect'}].forEach(rtcConfig => { | |||
/*{'vendors': {}, 'urls': []}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out portion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
dev().warn(TAG, `Insecure RTC errorReportingUrl: ${errorReportingUrl}`); | ||
return; | ||
} | ||
const whitelist = {ERROR_TYPE: true, HREF: true}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably include the timeout macro set by the pub if the errorType is timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My biggest concern is that this change adds size to v0.js. ping @choumx and @jridgewell for better ideas.
src/transport.js
Outdated
@@ -14,27 +14,27 @@ | |||
* limitations under the License. | |||
*/ | |||
|
|||
import {Services} from '../../../src/services'; | |||
import {Services} from './services'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @jridgewell @choumx
What would be a better approach to share code between two extensions.
* @param {!Window} win | ||
* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampDoc | ||
*/ | ||
export function sendErrorMessage(errorType, errorReportingUrl, win, ampDoc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<amp-analytics>
supports sending user error, that could be another way to support this.
Is error collecting temporary? or is this a feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a feature of RTC. We wanted a way to do this outside of requiring pubs setup amp-analytics ideally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we insert analytics like what we do with activeView?
}; | ||
const url = Services.urlReplacementsForDoc(ampDoc).expandUrlSync( | ||
errorReportingUrl, macros, whitelist); | ||
sendRequest(win, url, {image: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correct, this will always send a request with image. Then why importing from transport.js
, we can simply create new Image()
with src equals to url. Let me know if that works. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
6b1c534
to
eaf1286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment
* @param {!Window} win | ||
* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampDoc | ||
*/ | ||
export function sendErrorMessage(errorType, errorReportingUrl, win, ampDoc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
win
is not required, can get it from ampdoc.win
.
nit: We usually put ampdoc
as the first param.
* Add pingback * Change fraction * Allow HREF as macro * Responding to feedback * Respond to feedback * Fix lint * Respond to feedback * Update whitelist * Unmove transport.js * Respond to feedback * Fix mistakes * More responding * Undo class change * Fix tests
With this change, vendors and publishers will be able to get some simple error reporting.