Question: The following is failing to return the correct child node, even though it is actually finding the child further up the tree. It appears to drop the child after finding it, ad proceed to just keep searching the rest of the tree.

```
private Node<K, V> getNode(K key, ArrayList<Node<K, V>> children){
    if (children == null) return null;

    if (root.getKey().equals(key)) return root;

    for (Node<K, V> child : children) {
        if (child.getKey().equals(key)) return child;
        getNode(key, child.getChildren());
    }

    return null;
}

```

I tested it with the following code:

```
Tree<Integer, String> tree = new Tree<>(1, "1");

tree.addChild(1, new Node<>(2, "2"));
tree.addChild(1, new Node<>(3, "3"));
tree.addChild(1, new Node<>(4, "4"));
tree.addChild(2, new Node<>(5, "5"));

System.out.println(tree.addChild(5, new Node<>(6, "6")));
System.out.println(tree.addChild(5, new Node<>(7, "7")));

```

However, the console outputs `false` both times, even though it should be `true`. The child with a key of `5` cannot be found, even though I added one to the tree.

Answer: 
Some browsers have implemented a version of the [not-yet-standard](https://www.w3.org/TR/resource-timing/), [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/Resource_Timing_API/Using_the_Resource_Timing_API) where you can collect some of this information.

Some browsers may have some of this info available to browser extensions as part of their developer tools support, but that would require the installation of a custom extension, not something that could be done from a regular web page.

For very specific operations where you control the calling code or you know the calling code, it is possible to instrument some things. For example, if you know that all ajax calls go through one particular function, you can hook that function and it's completion handlers and monitor all ajax calls.
You can use [Resource Timing](http://www.w3.org/TR/resource-timing/) API to get all relevant information (domain lookups, cache hits, redirects, etc.) about each resource being loaded on your website.

You can read about it [here](http://calendar.perfplanet.com/2012/an-introduction-to-the-resource-timing-api/). There is also a [bookmarklet](http://andydavies.github.io/waterfall/) that generates a page load waterfall using this API.

Resource Timing API is available in Chrome, Chromium, Chrome Mobile and IE10. Firefox team [seems to be working on it](https://bugzilla.mozilla.org/show_bug.cgi?id=822480).