New issue
Advanced search Search tips

Issue 778422 link

Starred by 0 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature

Blocked on:
issue 910417

Blocking:
issue 782189



Sign in to add a comment

Add call counters to WebView APIs

Project Member Reported by paulmiller@chromium.org, Oct 25 2017

Issue description

I think we'll want to create a single enum histogram, with an enum value for each API we want to record. See comments in:

https://cs.chromium.org/chromium/src/base/metrics/histogram_macros.h

Enum histograms are recommended for counting events. We can add new enum values for new APIs, so long as we never change or re-use existing values.

API call counts will probably only make sense in relation to each other. I don't imagine e.g. "loadUrl was called 1 gazillion times globally" would be nearly as useful as "loadUrl is called twice as often as postUrl". So I'm guessing it would be more useful to see these counts in a single histogram (rather than a separate histogram for each API). Also, if we were to have separate histograms, it's not clear what value we should record each time their APIs were hit.

Additional info about how APIs are called (e.g. "how often is loadDataWithBaseURL called with historyUrl=null/empty/baseUrl?") will require separate histograms.

Caveat: since metrics is native, we won't be able to count APIs which can be called without initializing WebView, or which don't plumb into the WebView implementation, e.g. getCurrentWebViewPackage.
 
Owner: ntfschr@chromium.org
Status: Assigned (was: Available)
I can take this. Paul and I discussed some potential concerns, so I'll document these in a small design doc.
Doc is up at: https://goo.gl/dSyEVQ (requires @google.com org, but I can switch it to @chromium.org if requested).
Owner: ----
Status: Available (was: Assigned)
I won't have time to work on this for the next couple weeks. It'd be great if another team member could take this up! Otherwise, I'll take this back when I get a spare moment.
Owner: jamwalla@chromium.org
Status: Assigned (was: Available)
I can get this started, at least. What was the progress on the spreadsheet of APIs (click through the doc)?

here's a WIP CL of the 15 apis marked "yes" on the spreadsheet: crrev.com/c/954351

What sort of investigation is needed to make decisions about the rest of the APIs?
I never finished the spreadsheet. I expanded the doc to explain when it's safe to collect metrics for an API.

Another way to do the investigation would be to exclude anything which has "@Override" in the WebView class (we probably don't care about View methods we're implementing, only WebView-defined APIs).

Another idea: we could break this into multiple UMA histograms (one per frameworks class). We can still make comparisons across histograms (e.g., WebView#loadUrl vs. CookieManager#setCookie), and it might give us a better perspective to answer questions like "how often do apps use the WebView APIs as opposed to CookieManager?"
Blocking: 782189
Sorry for the delay on this! I thought that it might be easier to approach this class-by-class, rather than trying to find an exhaustive set of APIs across webview. It'd still be easy to compare UMA results across different histograms (as Nate mentions in #5).

I'm sending out crrev/c/1070529 to add call counters to WebViewChromium.java; I tried to be exhaustive and only exclude callbacks and things related to rendering/input (that will be called very often). Let me know if there's a beter way to approach this.
Owner: paulmiller@chromium.org
paulmiller@, could you take this over from jamwalla@?
Cc: -jamwalla@chromium.org
Labels: -Pri-3 Pri-2
Status: Available (was: Assigned)
Moving to available because I think this is a great candidate to Make WebView Better. Anyone should feel free to steal this back.
Owner: ----
Blockedon: 910417
Owner: changwan@chromium.org
Status: Started (was: Available)
Changwan has a patch: https://chromium-review.googlesource.com/c/chromium/src/+/1343104
Project Member

Comment 15 by bugdroid1@chromium.org, Dec 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1332ecc2ae47eed0da1fcfdb123907abea22009e

commit 1332ecc2ae47eed0da1fcfdb123907abea22009e
Author: Changwan Ryu <changwan@google.com>
Date: Thu Dec 13 01:23:26 2018

Add UMA call counters for APIs in WebViewChromium

Add the histogram WebView.ApiCall to count calls to
WebView APIs in WebViewChromium.java

Bug: 778422
Change-Id: If1ac5e4fbf6ca4f6066beaf66a52a5776280a5be
Reviewed-on: https://chromium-review.googlesource.com/c/1343104
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616146}
[modify] https://crrev.com/1332ecc2ae47eed0da1fcfdb123907abea22009e/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
[modify] https://crrev.com/1332ecc2ae47eed0da1fcfdb123907abea22009e/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/1332ecc2ae47eed0da1fcfdb123907abea22009e/tools/metrics/histograms/histograms.xml

Cc: -sbirch@chromium.org des...@chromium.org tobiasjs@chromium.org

Sign in to add a comment