Measuring tab and window usage in Firefox

With Mozilla’s Telemetry system, we have a powerful way to collect measurements in the clients while still complying to our rules of lean data collection and anonymization. Most of the measurements are collected in form of histograms that are created on the client side and submitted to our Telemetry pipeline. However, recent needs for better understanding user interaction with the browser has led to the introduction of a new measurement type, the scalar probe. This article compares the two measurement tools and provides guidance on how to submit and analyse the scalars.



Build Firefox for Android on Ubuntu and test it on Windows!

Sadly, right now (and until bug 1169873 is fixed), it’s not possible to build Firefox for Android on Windows. That’s not nice, especially if you need to track down some Android-only failures triggered by your code 🙂

Until recently I was able to run my Android Virtual Device within my Ubuntu Virtual Machine (yeah, tricky). Then something broke in OracleVM (ticket 12941), preventing me from starting the Android emulator.

Here comes the good news: there’s a way to spawn an Android emulator on Windows, build Firefox for Android on a VM and then run it. Yay!

Let’s go straight to the action: the HOST prefix is used for actions performed on the Windows system, and GUEST for actions on the Linux VM.

  • HOST – Install the Android SDK (no studio) and the Android Platform Tools.
  • HOST – Set the ANDROID_HOME environment variable to the installation path of the Android SDK.
  • HOST – Add %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools at the end of your PATH environment variable.
  • HOST – Check that adb.exe can be run from a command prompt.
  • HOST – Install an SSH daemon. OpenSSH over Cygwin is a nice choice, there’s even an installation guide on that 🙂
  • HOST – Run ./mach android-emulator –verbose –wait from the Mozilla source directory. This command will automagically fetch the AVD and run it when done.
  • HOST – Run the adb devices command. The emulator should be shown there.
  • GUEST – Try to telnet into the emulator, to see if everything is running correctly: telnet <HOST IP> 5037 ( in my case, but that depends on your HOST-GUEST network configuration).
  • GUEST – Run adb kill-server to stop any server running on the guest.
  • GUEST – Install autossh, which monitors and re-establishes the SSH connection when it fails: sudo apt-get install autossh
  • GUEST – Now the fun part. We forward the local 5037 port to the 5037 port on the Windows host. The adb daemon is listening on that port. autossh -nNL5037:localhost:5037 -oExitOnForwardFailure=yes -o PreferredAuthentications=password -o PubkeyAuthentication=no <HostUsername>@<HOST IP>
  • GUEST – Running adb device on the guest machine will show the emulator running on the Windows host.
  • GUEST – Build and run Firefox for Android! ./mach build && ./mach package && ./mach install && ./mach run

Yes, this also works with ./mach test and all its happy friends!

Last, but not least, thank you to Stephen Niedzielski for your great answer on SO.


Spark 101: getting the status of your job

As Roberto Vitillo says in his excellent post about Spark best practices:

Running Spark jobs without the Spark UI is like flying blind.

And that’s especially true if your spark job keeps crashing or it’s crunching big data (yeah, I had to use the expression at least once).

If you don’t want to setup a SOCKS proxy or, for some reason, that simply doesn’t work for you (my case!), you can still access the Spark UI from the cluster’s main node (thank you Mark!):

lynx localhost:4040

It will get you to this nice little page, showing you the status of the scheduled jobs:

Spark UI using Lynx

Spark UI using Lynx

Lynx FTW!