Skip to content

Introduce examiner.js to use LongTask API to detect long running javascript in 3p frames#9260

Merged
lannka merged 3 commits intoampproject:masterfrom
lannka:long-task
May 15, 2017
Merged

Introduce examiner.js to use LongTask API to detect long running javascript in 3p frames#9260
lannka merged 3 commits intoampproject:masterfrom
lannka:long-task

Conversation

@lannka
Copy link
Copy Markdown
Contributor

@lannka lannka commented May 11, 2017

for #9326

LongTask API is now available in latest Chrome (58.0)
This is an example of using LongTask API to find 3P frame culprit.

screen shot 2017-05-10 at 10 37 12 pm

@lannka lannka requested a review from dvoytenko May 11, 2017 05:37
@dvoytenko
Copy link
Copy Markdown
Contributor

@lannka Great! Is it worth find a way to add a sampled CSI ping as well?

@lannka
Copy link
Copy Markdown
Contributor Author

lannka commented May 11, 2017

@dvoytenko that's what I'm hesitating. So far I don't know what to do with the data. how to normalize the data is also a challenge.

@dvoytenko
Copy link
Copy Markdown
Contributor

I'm think in-line with your "probability of bad frames"

@dvoytenko
Copy link
Copy Markdown
Contributor

frames = animation frames of course.

@lannka
Copy link
Copy Markdown
Contributor Author

lannka commented May 11, 2017

@dvoytenko sure it can be another "bad frame" metric, we can send a the number of long tasks at the time we send the Good Frame Probability. We expect this metric should be strongly correlated to the existing metric. In that sense, it's not providing new stuff, but maybe a good back up to the existing metric due to its neutrality, since it has no dependency on runtime code

On the other hands, I'm more interested about the "attribution" info from LongTask API. We can find out which 3P iframes are exhausting resources. However, I'm still thinking what we can do with that.

@dvoytenko
Copy link
Copy Markdown
Contributor

Cool. Let's merge this PR and re-open a task for LT API when ready.

@lannka
Copy link
Copy Markdown
Contributor Author

lannka commented May 12, 2017

To make this useful for all AMP developers, maybe a better place to load this script is when #development=1, just like how /v0/validator.js is loaded. Or, we can even compile this little piece of code into /v0/validator.js?

This way, developers can see what 3p frame is slowing their AMP pages down. This is our most conservative way to use such info.

@dvoytenko @Gregable thoughts?

@lannka
Copy link
Copy Markdown
Contributor Author

lannka commented May 12, 2017

Talked to @Gregable validator.js is also used in non-Browser env. so the code here won't run since it requires browser API.

will introduce it as a separate binary, like https://cdn.ampproject.org/v0/examiner.js

@lannka
Copy link
Copy Markdown
Contributor Author

lannka commented May 13, 2017

@dvoytenko I moved the code to a separate binary. Once deployed, I will get it loaded while #development=1

@lannka lannka changed the title Use LongTask API to detect long running javascript in 3P ad examples. Introduce examiner.js to use LongTask API to detect long running javascript in 3p frames May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants