Closed Bug 2093447 Opened 12 days ago Closed 4 days ago

Design and implement a way for Firefox Desktop to backup and restore client_id outside of Glean's datadir

Categories

(Data Platform and Tools :: Glean: SDK, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: chutten|PTO, Assigned: chutten|PTO)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 external file)

bug 2092245 documents an (infrequent) problem in Firefox Desktop where Glean's datadir appears to be wiped between runs. This is unlikely enough and widespread enough that it doesn't affect most analyses, but it does affect some.

Much like bug 1994757 introducing client_id.txt and bug 2044665 allowing it to be persisted across profile resets, we find ourselves in a situation where we are considering external storage solutions for backing up and restoring the value of the Glean client ID.

I propose this design:

  1. Once the value of the Glean client ID has been determined, call out via OnGleanEvents to the RLB with the determined value.
  2. RLB will re-export the event handler to embedders like FOG.
  3. In bug 2092245 FOG will use this handler to compare the determined value with any it has stored in the prefs. It will report on mismatches, empty values, etc. It will then store the provided value in the prefs for redundancy.
  4. On subsequent runs, FOG will supply to the Glean SDK during initialization backed_up_client_id=<the stored id>. This value will now be a last-ditch value that the Glean SDK can use in absence of other values found in the Glean SDK's storage. If the backed_up_client_id's value is a mismatch with the value obtained from the Glean SDK's own storage, the value from the Glean SDK's own storage will be preferred. These cases will be added to existing client ID recovery instrumentation.
    • At first we will not actually use the last-ditch value and instead will merely report instrumentation. This will allow us to validate that the solution will work, and DS to size out the effect this will have on product metrics.
  5. FOG, already responsible for fetching and listening for changes to the data upload pref, will now be responsible for clearing its backup of the client ID value whenever FOG would initialize Glean with collection_enabled: false or call set_collection_enabled(false).

ni?Jan-Erik and Travis for feedback on the proposed design

Flags: needinfo?(tlong)
Flags: needinfo?(jrediger)

:csadilek came up with a tidier way: instead of a param on initialize and a new fn on OnGleanEvents, the SDK could instead define an interface ExternalBackup { pub fn store(key, value); pub fn load(key) -> value; } and take an optional instance of ExternalBackup on initialize. That way we could leave the SDK in charge of naming, formatting, timing... all the parts that could be particular. And with the addition of a pub fn clear(key); and/or pub fn clear_all(); we could even keep the clearing logic central to the SDK.

What say you, fellow Glean nerds?

So I understand:

  • FOG would provide an implementation of ExternalBackup
  • Glean on initialize:
  • Glean would then, after all this is settled, call backup.store("client_id", "74f3b3f1-f62c-44ff-aaeb-ad25c2ea6c18")
  • FOG's implementation dumps that into a pref (or whatever it wants)

I ... kinda like it. Yes, it's still more logic that we need to add, but all the state transitions remain on the Glean side.
We need to request that ExternalBackup needs to be fast, etc., but in the end if it's slow that would be the app's responsibility anyway.

(and now my mind already wanders to "what if we add a ClientIdTxtExternalBackup implementation instead of doing it inline as we do now?)

Flags: needinfo?(jrediger)

Yes, I like the interface idea, and the flexibility it gives to the integrating application on how this'll work, meaning it will be easier to get something like it working for mobile as well as Desktop.

+1 from me.

Flags: needinfo?(tlong)
Assignee: nobody → chutten
Severity: -- → N/A
Status: NEW → ASSIGNED
Priority: -- → P1
Attached file data review request —
Attachment #9689652 - Flags: data-review?(royang)

Comment on attachment 9689652 [details]
data review request

Request for data collection review

All questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.

  1. What questions will you answer with this data?
  • How often does it look like to the Glean SDK that this is a first run, but the backup shows that it isn't?
  • How accurate is the backup's storage of the client ID?
  • Will backing up and restoring the client ID work to reduce the number of Glean client ID regenerations?
  1. Why does Mozilla need to answer these questions? Are there benefits for users? Do we need this information to address product or business requirements? Some example responses:
  • The Glean client ID is rather important to basically every longitudinal and population analysis as it is the core anonymous identifier that ties technical and interaction data together in Mozilla project.
  1. What alternative methods did you consider to answer these questions? Why were they not sufficient?
  • We have a pretty good idea via the comparison of Legacy client ID vs Glean client ID,
    but we need direct instrumentation to see if our proposed fix will work.
  1. Can current instrumentation answer these questions?
  • No.
  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories found on the Mozilla wiki.

Note that the data steward reviewing your request will characterize your data collection based on the highest (and most sensitive) category.

Measurement Name Measurement Description Data Collection Category Tracking Bug
glean_health.backup_client_id_status Count of different states that happened when using the external backup client_id value. technical https://bugzilla.mozilla.org/show_bug.cgi?id=2093447
  1. Please provide a link to the documentation for this data collection which describes the ultimate data set in a public, complete, and accurate way.
  1. How long will this data be collected? Choose one of the following:
  1. What populations will you measure?
  • All channels, all locales, all countries. No filters.
  1. If this data collection is default on, what is the opt-out mechanism for users?
  • Default Glean SDK opt-out mechanism, found in the product's preferences.
  1. Please provide a general description of how you will analyze this data.
  • We will count the instances of the various error and success cases and compare them to our existing Legacy vs. Glean analyses. After this lands, we will add these cases to our ongoing monitoring to catch regressions.
  1. Where do you intend to share the results of your analysis?
  • In bugs, documents, and conversations. Some results will be publicly visible and some will not.
  1. Is there a third-party tool (i.e. not Glean or Telemetry) that you are proposing to use for this data collection? If so:
  • No third-party tools.
Attachment #9689652 - Flags: data-review?(royang) → data-review+

Code's merged.

Next up: Making sure it all works well in m-c, cutting a hotfix release, merging it forward to latest release, vendoring into m-c, shipping, validating, turning it on

Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: