Skip to content
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

Implement frame traversal for the navtiming and restiming plugins #9

Closed
wants to merge 25 commits into from
Closed

Conversation

philbooth
Copy link

The approach I've taken is to add a frames array property to the request when accessible frames are detected by either plugin. The format of each object in frames is similar to the main beacon format, only nested. So each object in the array has a u property containing the URL and will also have properties from the navtiming plugin, the restiming plugin or both. They may have nested frames too, which may have etc and so on.

In doing this I made some changes to both plugins in order to get code-reuse. But essentially they are the same as they were before, with additional calls to some new functions that I added to the core module: forEachFrame and addFrameVar. Implementing those necessitated a further couple of private functions in the core module, addVarTo and getAccessibleFrames.

Tested in latest Chrome, Firefox & IE.

What do you think, any good?

@bluesmoon
Copy link
Owner

Thanks a lot. Will take me a bit to review, but your approach sounds right.

@philbooth
Copy link
Author

Fyi, I've just updated the pull request with another change.

I realised earlier that this sentence:

They may have nested frames too, which may have etc and so on.

...was wrong, I hadn't considered nested frames at all in the first cut.

The PR handles them now, they're implemented them in this commit if you want to look at it separately: https://github.com/philbooth/boomerang/commit/926d7f6fba859784fe17f8546a1f89bad6769279

Also, in case it's helpful, the little test-case I've been using is here:

https://dl.dropboxusercontent.com/u/15315257/frames.tar.gz

}
}

return cachedFrames[url] = result;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you split this onto two lines so that it doesn't catch anyone by surprise?

@bluesmoon
Copy link
Owner

Apart from my line notes, this looks good.

@philbooth
Copy link
Author

// nt_fet_st: 1403585426765,
// ...,
// frames: [
// {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the frame url makes it here, I'd add that as well.

@philbooth
Copy link
Author

@andreas-marschke
Copy link
Collaborator

Since @philbooth has added everything necessary and according to Github this PR can be merged can we close this? Has this been reviewed to its fullest extend?

@bluesmoon
Copy link
Owner

I haven't been able to fully review it, but if you'd like to do so and post comments, that would help.

@philbooth
Copy link
Author

So I guess one problem with this pull request is that it changes a lot of stuff, which introduces extra risk.

The best way to mitigate that risk is, I reckon, to have a comprehensive unit test suite that covers current behaviour including all the edge cases and so on. This and other pull requests can then be verified against that suite and we can be more confident about not breaking stuff.

Obviously, there is a lot of grunt work involved in writing a unit test suite, even more so for client-side code which has a ton of browser differences to work around. But I'm happy to help out on that front if you guys think it is a good way to go.

Thoughts?

@andreas-marschke
Copy link
Collaborator

I was thinking about unit-testing and best practices of implementing Unit-Tests in boomerang itself. I only hesitated yesterday to open up yet another issue just for an RFC on Unit-Testing or whats preferred by the users of Boomerang.

What I can think of given that grunt has been integrated into boomerang on bluesmoon/boomerang I'd guess something like phantomjs or selenium and qunit or jasmine would be good.

I worry however that not all parts of core boomerang.js can be tested this way as of now as they are not directly accessible. Splitting them up and building the closure for BOOMR upon calling grunt would be a good way forward.

An added benefit would be a better separation of concerns inside boomerang to make it easier for newcomers to look at and understand the code instead of having to grok through a large monolithic file.

Does anyone of the people subscribed or watching this repository have pointers or suggestions for a good javascript Unit-Testing Framework?

What we'd also need is the abillity to unit-test all the plugins since they do most of the actual work in terms of gathering the data. Therefore having an extensible suite of Unit-Tests that can be extended towards plugins would be excellent.

@bluesmoon If I understood your history correctly you should've worked at yahoo around the time NCZ was there. Anything regarding his work on maintainable Javascript in production that you can remember?

By the way the book that came out of his experience at yahoo is a tremendous resource.

DISCLAIMER: I'm not affiliated with O'Reilly, NCZ or any of the book publishing involved parties, I just thought it was a really good book.

@philbooth
Copy link
Author

Forked the unit-testing discussion to akamai#40, seemed like it warranted a separate thread.

bluesmoon pushed a commit that referenced this pull request Apr 2, 2015
We need to skip the first item in the latency array before we do IQR
filtering.  The IQR filtering runs on a sorted array, which means we
lose information about which item was first.

This change drops that item before doing any other processing.
bluesmoon added a commit that referenced this pull request Apr 2, 2015
Sends plugins in the initial config.js request
@nicjansma
Copy link
Collaborator

Phil, I believe many of your ideas here are implemented in this SOASTA PR: akamai#68

It also includes a comprehensive unit and integration test suite.

bluesmoon pushed a commit that referenced this pull request Mar 21, 2016
We need to skip the first item in the latency array before we do IQR
filtering.  The IQR filtering runs on a sorted array, which means we
lose information about which item was first.

This change drops that item before doing any other processing.
@nicjansma nicjansma closed this May 2, 2016
bluesmoon pushed a commit that referenced this pull request Mar 8, 2017
SPA test #9: AutoXHR After Load fix for IE

Reviewed By: Charlie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants