Closed Bug 868442 Opened 7 years ago Closed 7 years ago

[meta] First revision of Android Health Report client

Categories

(Firefox Health Report Graveyard :: Client: Android, defect)

ARM
Android
defect
Not set

Tracking

(firefox23+ fixed, relnote-firefox 23+)

RESOLVED FIXED
Tracking Status
firefox23 + fixed
relnote-firefox --- 23+

People

(Reporter: rnewman, Assigned: rnewman)

References

Details

(Keywords: meta, Whiteboard: [qa+])

No description provided.
Depends on: 868443
Depends on: 868444
Depends on: 868445
Depends on: 868446
Depends on: 868447
Depends on: 868449
Depends on: 870110
No longer depends on: 868446
Depends on: 873496
No longer depends on: 870110
Depends on: 875400
Depends on: 876473
https://tbpl.mozilla.org/?tree=Try&rev=ac2b2f249dfa

Includes document generation, hooked up to non-functional a:hr page. Records searches with rich environments. Remaining: session recorder, uploader.
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Depends on: 878303
Depends on: 878670
Nick: this bug is for uplift bugs. If it ain't gonna be done this week, or it adds strings, please don't block this bug on it.
Some QA notes.

(While I'm here, I'm untracking Bug 879555 and Bug 879558 for the first release. We'd ship without them, so they don't block this bug.)

This will all be easier to test once about:healthreport is working. Sorry about that, chaps. In the mean time, you can watch some logs and make sure that the browser works!

Please report anything you notice out of the ordinary -- regressions in behavior, speed, etc., or error messages in the log.

Everything you need to test for this bug, except for the uploader, will be in Thursday morning's Nightly.



= Testing FHR data collection on Android =

== Core concepts ==

FHR's data collection component ("BrowserHealthRecorder", henceforth BHR) initializes when GeckoApp starts, and shuts down when GeckoApp shuts down. Its purpose is to record events that occur during browsing, writing them into two places: a profile information cache, and the FHR database.

The PIC is an on-disk JSON snapshot of some state that is only accessible via Gecko: your add-ons, and some pref state. Firefox Health Report can run to generate documents when Gecko isn't alive, so we need to track these things elsewhere.

The BHR manages a PIC. BHR listens to events from Gecko and elsewhere, updating the PIC and its own internal state.

The PIC will change when the following things occur:

* The value of the blocklist ping pref (extensions.blocklist.enabled) changes
* The value of the telemetry enabled pref (varies) changes
* Your add-on set changes (enabled, disabled, installed, uninstalled).

You'll see log messages accordingly.

That internal state largely consists of an *environment*. An environment is a stable collection of system, app, and add-on properties. If one of these changes -- e.g., you upgrade Firefox, or install a new add-on -- your environment changes. This is so that analysis can reflect these properties: one can attribute crashes and other behaviors to certain environments, for example.

The BHR writes into FHR's database via a ContentProvider. Events are recorded in a pair of tables, and are rolled up into JSON by a document generator.

== Captured data ==

FHRv0 captures environment data, searches (not search terms), and sessions.

An example document looks like this. In this case, on May 30th I ran a single session, which ended in a pause, with Gecko taking 2752msec to launch, and the Java app 574msec to launch. A subsequent session was killed (by reinstalling the app) before it could record times.

I performed three searches in that time.

(Note that this document is fake: each interaction with the Awesomebar currently causes a session to end! This will be fixed in Fx25, when the Awesomebar goes away.)

{
  "data": {
    "last": {},
    "days": {
      "2013-05-30": {
        "SXTgYNkl2GAG\/2AIMIslnOx0IwY=": {
          "org.mozilla.appSessions": {
            "abnormal": [
              {
                "stopped": 0,
                "r": "A",
                "oom": 0
              }
            ],
            "normal": [
              {
                "r": "P",
                "sg": 2752,
                "d": 17,
                "sj": 574
              }
            ],
            "_v": "4"
          },
          "org.mozilla.searches.counts": {
            "barsuggest": {
              "google": 2
            },
            "bartext": {
              "amazon": 1
            },
            "_v": "3"
          }
        }
      }
    }
  },
  "environments": {
    "current": {
      "org.mozilla.sysinfo.sysinfo": {
        "memoryMB": 832,
        "cpuCount": 4,
        "architecture": "armeabi-v7a",
        "_v": 1,
        "version": "4.1.2",
        "name": "Android"
      },
      "org.mozilla.profile.age": {
        "_v": 1,
        "profileCreation": 15855
      },
      "org.mozilla.addons.active": {
        "_v": 1
      },
      "org.mozilla.appInfo.appinfo": {
        "isTelemetryEnabled": 0,
        "_v": 2,
        "isBlocklistEnabled": 1
      },
      "geckoAppInfo": {
        "updateChannel": "default",
        "id": "{aa3c5121-dab2-40e2-81ca-7ea25febc110}",
        "os": "Android",
        "platformBuildID": "20130529204003",
        "platformVersion": "24.0a1",
        "vendor": "Mozilla",
        "name": "fennec",
        "xpcomabi": "arm-eabi-gcc3",
        "appBuildID": "20130529204003",
        "_v": 1,
        "version": "24.0a1"
      },
      "hash": "SXTgYNkl2GAG\/2AIMIslnOx0IwY=",
      "org.mozilla.addons.counts": {
        "extension": 0,
        "plugin": 1,
        "_v": 1,
        "theme": 0
      }
    }
  },
  "thisPingDate": "2013-05-30",
  "version": 3
}

== Causing environment transitions ==

Simply install an add-on, or disable one. If you do then undo an action several times, you should transition between the same two environments. Take an action (e.g., cause a new session) in each environment to ensure that it is recorded.

== Causing sessions to occur ==

Each time you launch the browser activity, a session begins. Each time you switch away (including to the Awesomebar, as of Fx24 and Fx23), the session ends. If Android decides to terminate the activity completely, the next session will restart Gecko, and will record startup times accordingly. Brief switches away will cause merely a short pause, and the next session will be missing "sg" and "sj".

If you terminate the activity *without pausing it first*, an orphan session will be recorded *on next launch*. The simplest way to do that is with `adb`.

== Recording searches ==

There are three kinds of searches: text typed in the Awesomebar ("bartext"), text typed and a keyword suggestion picked ("barsuggest"), and the use of a search keyword ("barkeyword").

* Type something in the Awesomebar, hit enter.

  D/GeckoHealthRec( 1489): Recording search: google, bartext (15842, 2).

* Type something in the Awesomebar, pick a search suggestion.

  I/GeckoAwesomeBar( 1489): Recording search: amazondotcom, barsuggest
  D/GeckoHealthRec( 1489): Recording search: amazondotcom, barsuggest (15842, 2).

* Sync a keyword search item, and type, e.g., "imdb shatner". (<https://support.mozilla.org/en-US/kb/how-search-from-address-bar>).

  I/GeckoAwesomeBar( 1489): Recording search: null, barkeyword
  D/GeckoHealthRec( 1489): Recording search: other, barkeyword (15842, 2).

You'll also be able to see these in the generated report, for the correct day and environment.

== Things to validate ==

* That sessions are correctly recorded on pause and on termination. (Environment transitions will cause a session to be recorded after Bug 880109 is implemented.)

* That searches are recorded in the current date and environment, and with the correct type, with partner providers being named and others being recorded as "other".

* That device data in each environment appears correct.

* That no error traces appear in the ADB log.

* After about:healthreport is implemented for mobile devices, you should be able to see the results of your actions as part of the generated document by visiting that page.
No longer depends on: 879555, 879558
Whiteboard: [qa+]
Depends on: 880534
Depends on: 880549
Here is my uplift queue.

Lukas, would you prefer me to flag all 23 patches for uplift (although the patches in the bug, as with many uplifts, aren't necessarily the exact code that will land), or would you just like me to walk you through them all on Tuesday?

374417ab7178: Bug 858742 - Part 1: Firefox Health Report storage for Android. r=nalexander
eb43acde496e: Bug 858742 - Part 2: manifest change for Firefox Health Report content provider. r=trivial
7803bb333eee: Bug 873338 - JavaDoc and checkstyle warnings. r=trivial
64cbce6df9fb: Bug 868449 - Part 1: provide an EnvironmentBuilder to generate environments for FHR. r=nalexander
eacb047aa7f7: Bug 873360 - Profile information storage. r=nalexander
efe8602a121a: Bug 868274 - Part 1: extend generateDocument to extract data from profile. r=nalexander
c32533bf03f3: Bug 858742, Bug 868449 - Fennec integration for Firefox Health Report on Android. r=mfinkle, nalexander
b99064b6c132: Bug 875151 - Shutdown/startup race in BrowserHealthRecorder. r=nalexander
90c53f21e0d1: Bug 875088 - HealthReportGenerator.java fails to compile with JDK 1.7: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap. r=cpeterson
54d82ae49d3b: Bug 875401 - Switch HealthReportGenerator to use org.json.JSONObject/JSONArray. r=nalexander
3051ff11a5be: Bug 875400 - Part 1: add-on support and hashing changes for Environment. r=nalexander
4e47042b767e: Bug 875400 - Part 2: provide add-ons and pref changes to FHR. r=mfinkle
b7554b86cefc: Bug 873496 - Part 1: searches provider for FHR on Android. r=cpeterson
bcf9daabbccb: Bug 873496 - Part 2: add provider filtering to search provider. r=nalexander
0b149bc52ebe: Bug 876473 - Provide Java-generated Firefox Health Report to about:healthreport. r=rnewman
99642951e827: Bug 878670 - Version profile information cache file. r=nalexander
a31f790f0681: Bug 878303 - Part 1: implement TYPE_COUNTED_STRING_DISCRETE. r=nalexander
5ccd0592e074: Bug 878303 - Part 2: use COUNTED_DISCRETE type for searches. r=nalexander
79088e422daf: Bug 868445 - Part 1: allow recording of JSON objects. r=nalexander
530fbc32771b: Bug 868445 - Part 2: sessions provider for FHR on Android. r=nalexander
1782e033c17a: Bug 880171 - Part 1: return null if unable to retrieve storage in EnvironmentBuilder. r=nalexander
2d3c9e3daa76: Bug 880171 - Part 2: handle failure to retrieve storage from EnvironmentBuilder. r=nalexander
99311ea7ddce: Bug 880549 - Include add-on blocklist state in payload. r=mfinkle


I still want a QA pass on this, and we'll also want to uplift Bug 828654 (though we would ship without it), but I figure it's good to get ahead of the game!
Flags: needinfo?(lsblakk)
(In reply to Richard Newman [:rnewman] from comment #4)

> Lukas, would you prefer me to flag all 23 patches for uplift (although the
> patches in the bug, as with many uplifts, aren't necessarily the exact code
> that will land), or would you just like me to walk you through them all on
> Tuesday?

Let's walk through on Tues - but yet, even though painful & tedious when on this scale, please do nominate each patch if only because when tracking down regressions in future releases we might want to know what actually landed in case a backout is requested.
Flags: needinfo?(lsblakk)
(In reply to lsblakk@mozilla.com [:lsblakk] from comment #5)

> Let's walk through on Tues - but yet, even though painful & tedious when on
> this scale, please do nominate each patch if only because when tracking down
> regressions in future releases we might want to know what actually landed in
> case a backout is requested.

Done!
I've run the check on a few devices. With nicks help, I was able to verify certain issues are expected at this point in time (mainly the errors around the data to service on about:hr). Data is recording correctly on phones.

On a galaxy tab, the search suggest buttons were being recorded as bartext instead of barsuggest. Again this all worked fine on a couple phones. Let me know if you want me to recreate logs of that. It's nothing more than I described. Couldn't test the addons changes on the tablet either due to crashing in access Tools.
(In reply to Tracy Walker [:tracy] from comment #7)
> I've run the check on a few devices. With nicks help, I was able to verify
> certain issues are expected at this point in time (mainly the errors around
> the data to service on about:hr). Data is recording correctly on phones.

Thanks for testing, Tracy.

> On a galaxy tab, the search suggest buttons were being recorded as bartext
> instead of barsuggest. Again this all worked fine on a couple phones. Let me
> know if you want me to recreate logs of that. It's nothing more than I
> described.

Logs would be great. If you can repro, then I guess someone needs to Fedex me a Galaxy Tab… maybe there's a different code path being taken.

> Couldn't test the addons changes on the tablet either due to
> crashing in access Tools.

Could you file that bug in Firefox for Android : General?
Depends on: 881763
All the client work here is done and uplifted.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: Firefox Health Report → Firefox Health Report Graveyard
You need to log in before you can comment on or make changes to this bug.