Implement Telemetry performance logging for SocialAPI

RESOLVED FIXED in Firefox 17



6 years ago
6 years ago


(Reporter: jjensen, Assigned: Felipe)


Firefox 17
Windows 7

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [Fx17])


(1 attachment)



6 years ago
In order to better understand the SocialAPI's performance in the field with testers and users, it would be useful to include, as part of the regular Telemetry pings for opted-in users, usage and performance data:

1) Whether social.enabled is True
2) Whether is True
3) Time taken for all content in sidebar to load
... others?
Whiteboard: [Fx17]


6 years ago
Assignee: nobody → felipc

Comment 1

6 years ago
Hi Felipe, thanks for taking this one on. Feel free to ping me any time if you have any questions or I can help in any way.

Comment 2

6 years ago
Created attachment 655090 [details] [diff] [review]
Patch v1

So this patch implements two different measurements in order to get a better sense of the feature usage. They are:

- A histogram that reports if the feature has been ever enabled in the current browser session (i.e. no restart). It won't report twice if the feature is disabled and re-enabled. It will have a bias towards people who restart the browser often.

- A histogram that reports when the feature is either turned on or off. Launching the browser with the feature already on will *not* report in this histogram, on purpose. It will have a bias towards people toggling on/off often.

I'm not a statistics person but I believe that these two combined will give a better understanding of the usage than any of those alone. For the first one, I was simply gonna measure if the feature was enabled on startup, but that would fail in cases when users disable that every time before shutdown (which isn't a rare usage pattern, I think)

Any feedback is appreciated
Attachment #655090 - Flags: review?(nfroyd)
Comment on attachment 655090 [details] [diff] [review]
Patch v1

Review of attachment 655090 [details] [diff] [review]:

::: toolkit/components/telemetry/TelemetryHistograms.h
@@ +536,5 @@
> +/**
> + * Social Telemetry
> + */
> +HISTOGRAM_FLAG(SOCIAL_ENABLED_ON_SESSION, "Social has been enabled at least once on the current session")
> +HISTOGRAM_BOOLEAN(SOCIAL_TOGGLED, "Social has been toggled to on or off")

Please note that TelemertyHistograms.h has been deleted on inbound via bug 781531.  Assuming it sticks, you'll have to add these definitions to Histograms.json.  It should be straightforward to do the translation; please ping me if you have questions.
Attachment #655090 - Flags: review?(nfroyd) → review+

Comment 4

6 years ago
Comment on attachment 655090 [details] [diff] [review]
Patch v1

Getting extra review from Shane to take a look at where I added the reporting for these telemetry probes
Attachment #655090 - Flags: review?(mixedpuppy)
Comment on attachment 655090 [details] [diff] [review]
Patch v1

>diff --git a/toolkit/components/social/MozSocialAPI.jsm b/toolkit/components/social/MozSocialAPI.jsm
>--- a/toolkit/components/social/MozSocialAPI.jsm
>+++ b/toolkit/components/social/MozSocialAPI.jsm
>@@ -8,25 +8,32 @@ Cu.import("resource://gre/modules/Servic

> var MozSocialAPI = {
>   _enabled: false,
>+  _everEnabled: false,
>   set enabled(val) {
>     let enable = !!val;
>     if (enable == this._enabled) {
>       return;
>     }
>     this._enabled = enable;
>     if (enable) {
>       Services.obs.addObserver(injectController, "document-element-inserted", false);
>+      if (!this._everEnabled) {
>+        this._everEnabled = true;
>+        Services.telemetry.getHistogramById("SOCIAL_ENABLED_ON_SESSION").add(true);
>+      }

is everEnabled supposed to be persistent across firefox sessions?  If it is only per-session, this is fine.
Attachment #655090 - Flags: review?(mixedpuppy) → review+

Comment 6

6 years ago
Yeah everEnabled is intended to be per-session, not persistent across them

Comment 7

6 years ago
Landed the enabled/toggled telemetry, described on comment 2:

John, let's keep this bug about these two probes landed, and open new bugs for more telemetry measurements once it's figured out what and how to measure them
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
You need to log in before you can comment on or make changes to this bug.