Bug 1625157 Comment 21 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Alessio Placitelli [:Dexter] from comment #20)
> (In reply to Travis Long [:travis_] from comment #19)
> > > - Can you check how legacy telemetry in Lockbox behaves in this case? (i.e. do we get the same client ids?)
> > 
> > Legacy telemetry allows setting the application ID, this is why the "chopping off" of the `CredentialProvider` bit works.
> 
> Sorry if I'm being pedantic :-) Does that mean that "core" pings from `CredentialProvider` and the Lockwise app report the same client_id? How would the application id affect this?

They use `UserDefaults` to store the client-id, which is a key-value store (similar to what our original Glean-AC used) that appears to be shared and accessible to both the app and extension.  By allowing setting of the application ID explicitly when telemetry starts, they don't have to detect whether it's running the app or the extension, they pull the client-id from shared key-value storage and set the application ID using their detection of the app extension and chopping off the `CredentialProvider` if needed, which is then used for the telemetry URL path, ensuring that all telemetry is going to the same endpoint with the same client ID.  

For Glean to be able to accomplish this, we would have to trick the extension into using the same directory as the base application (I'm not entirely certain if the extension can access the directory where the app stores Glean data due to sandboxing).  That would at least mean that both were storing in the same place and using the same client-id.  Unfortunately, since both could run in different processes this would mean that we would have to _know_ when it was the extension and record data to a file so that the app could read it and process it.  The problem here is how do we _know_ when it's the extension?  Do we force the consuming application to worry about this?  Do we try and do it internally in Glean and always check to see if that `XPC!` flag is set like Lockwise/Focus does to chop off the extra id bits, and if we find it how can we be certain that we are chopping off the right bits of the ID?
(In reply to Alessio Placitelli [:Dexter] from comment #20)
> (In reply to Travis Long [:travis_] from comment #19)
> > > - Can you check how legacy telemetry in Lockbox behaves in this case? (i.e. do we get the same client ids?)
> > 
> > Legacy telemetry allows setting the application ID, this is why the "chopping off" of the `CredentialProvider` bit works.
> 
> Sorry if I'm being pedantic :-) Does that mean that "core" pings from `CredentialProvider` and the Lockwise app report the same client_id? How would the application id affect this?

They use `UserDefaults` to store the client-id, which is a key-value store (similar to what our original Glean-AC used) that appears to be shared and accessible to both the app and extension.  By allowing setting of the application ID explicitly when telemetry starts, they don't have to care running the app or the extension, they pull the client-id from shared key-value storage and set the application ID using their detection of the app extension and chopping off the `CredentialProvider` if needed, which is then used for the telemetry URL path, ensuring that all telemetry is going to the same endpoint with the same client ID.  

For Glean to be able to accomplish this, we would have to trick the extension into using the same directory as the base application (I'm not entirely certain if the extension can access the directory where the app stores Glean data due to sandboxing).  That would at least mean that both were storing in the same place and using the same client-id.  Unfortunately, since both could run in different processes this would mean that we would have to _know_ when it was the extension and record data to a file so that the app could read it and process it like the hoop we jump through for lib-crash.  The problem here is how do we _know_ when it's the extension?  Do we force the consuming application to worry about this?  Do we try and detect it internally in Glean and always check to see if that `XPC!` flag is set like Lockwise/Focus does to do the right thing, and if so are we sure we are handling it the way that the application requires?

Back to Bug 1625157 Comment 21