-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feature(perf): add setFlushParams
method
#1862
Conversation
d743642
to
73e2fa7
Compare
setParams
methodsetParams
method
d7bab4d
to
0a12fa5
Compare
@cramforce PTAL |
899dfc4
to
b732b36
Compare
this.whenViewportLayoutComplete_() | ||
]).then(() => { | ||
const params = Object.create(null); | ||
params['canonicalUrl'] = documentInfoFor(this.win).canonicalUrl; |
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.
Lets instead use getSourceUrl
from url.js
but expose that via documentInfo
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 use window.location.href to pass into getSourceUrl or the canonical url? (result unlikely to be different, but not sure which one is more trusted)
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.
As discussed lets just use this.win.location.href
without the fragment.
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.
Looks great. A couple comments. |
b732b36
to
d0c3674
Compare
setParams
methodsetParams
method
d0c3674
to
e25a49d
Compare
@@ -135,9 +135,9 @@ export function adopt(global) { | |||
* @param {function()=} opt_flush | |||
* @export | |||
*/ | |||
global.AMP.setTickFunction = (fn, opt_flush) => { | |||
global.AMP.setTickFunction = (fn, opt_flush, opt_setParams) => { |
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.
Probably should have done this from the beginning, but could you use viewer.sendMessage() for all three of these messages to the viewer?
This is how all other communication with the viewer is done and it simpler for the viewer since it just receives whatever messages you send and we don't have to set up the callback by calling setTickFunction().
https://github.com/ampproject/amphtml/blob/master/src/service/viewer-impl.js#L703
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.
will do
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.
@ericfs can you enumerate/confirm the actual event names you want for these?
- 'tick'
- 'flush'
- 'setParams'
e25a49d
to
c1a3e25
Compare
params['canonicalUrl'] = documentInfoFor(this.win).canonicalUrl; | ||
|
||
/** | ||
* @param {!Object<string, string>} |
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.
Document
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.
9ba5dbf
to
2011b66
Compare
*/ | ||
sendCsi() { | ||
this.sendMessage_('sendCsi', undefined, false); | ||
} |
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.
@ericfs can you review the changes to viewer-impl.js here. thanks
@cramforce PTAL. changed quite a bit with the deprecation of |
ffd471d
to
256c75a
Compare
* Triggers "sendCsi" event for the viewer. | ||
*/ | ||
sendCsi() { | ||
this.sendMessage_('sendCsi', undefined, false); |
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 name should probably be changed to something more generic, but I think it makes sense to stick with this for now.
That is, the viewer can support both this and a new name, then the runtime can move to use the new name.
* @param {!JSONObject} message | ||
*/ | ||
setParams(message) { | ||
this.sendMessage_('setParams', message, false); |
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.
Could we use a different name? "setParams" seems a bit vague to me. Maybe "setFlushParams" or "setInstrumentationParams"
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. switched to setFlushParams
256c75a
to
87f90b6
Compare
@@ -33,6 +33,7 @@ export function documentInfoFor(win) { | |||
'AMP files are required to have a <link rel=canonical> tag.') | |||
.href).href, | |||
pageViewId: getPageViewId(win), | |||
sourceUrl: getSourceUrl(win.location.href), |
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.
Need to update the return doc comment above.
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.
thanks! done.
LGTM for viewer interface |
2462a86
to
798893a
Compare
@cramforce ping pong |
LGTM. Please manually check that reporting works when this lands in canary. |
@cramforce will do. whats the expected/estimated time frame that new data usually shows up, 24hrs? |
e4f23ec
to
80be55e
Compare
What I meant is to check that the requests are made and that the values look good. The Dashboard is too slow :( |
80be55e
to
94e7951
Compare
Alex or I can help to check. Feel free to ping one of us when the canary is ready. |
feature(perf): add `setParams` method
@ericfs this is live now (canary) |
tested on our demo viewer integration and that works there, need confirmation from @ericfs if format and data look good for |
setParams
methodsetFlushParams
method
No description provided.