-
Notifications
You must be signed in to change notification settings - Fork 1.3k
For #975: Adds telemetry for settings toggles #1896
Conversation
aecbf89
to
efad4fd
Compare
Request for data collection review formAll questions are mandatory. You must receive review from a data steward peer on your responses to these questions before shipping new data collection.
Until 04/01/2020 (renewed thereafter)
|
efad4fd
to
7e0ea3a
Compare
7e0ea3a
to
228e2e4
Compare
return event.wrapper != null | ||
} | ||
|
||
// Switch preferences that should have their toggle events sent to Glean | ||
private val switchPreferenceTelemetryAllowList = listOf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to the PreferenceToggled type under a private failable constructor to keep all of the logic around that type together 👍
preferences: | ||
preference_toggled: | ||
type: event | ||
description: > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extras need to be documented, you can look for an example here.
https://github.com/mozilla-mobile/fenix/blob/master/app/metrics.yaml#L42
In the documentation also put all the available options
|
||
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener { sharedPreferences, key -> | ||
context!!.components.analytics.metrics.track( | ||
Event.PreferenceToggled( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and then here you could "try" to create the event, and then track it if it succeeds.
d531336
to
ffc533a
Compare
Hoping @liuche can data review this. Jeff gave it a thumbs up before he left (after I updated the extras documentation), but I wanted a data review approval documented on the PR to be sure 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-review+ just one comment about values
Data Review Form (to be filled by Data Stewards)
-
Is there or will there be documentation that describes the schema for the ultimate data set available publicly, complete and accurate?
Yes, in metrics.yaml -
Is there a control mechanism that allows the user to turn the data collection on and off? (Note, for data collection not needed for security purposes, Mozilla provides such a control mechanism) Provide details as to the control mechanism available.
Yes, Fenix data controls -
If the request is for permanent data collection, is there someone who will monitor the data over time?**
No, @vesta0 will monitor and it has expiry -
Using the category system of data types on the Mozilla wiki, what collection type of data do the requested measurements fall under? **
Type 2, interaction with settings provided by Fenix -
Is the data collection request for default-on or default-off?
Default on -
Does the instrumentation include the addition of any new identifiers (whether anonymous or otherwise; e.g., username, random IDs, etc. See the appendix for more details)?
No -
Is the data collection covered by the existing Firefox privacy notice?
Yes -
Does there need to be a check-in in the future to determine whether to renew the data? (Yes/No) (If yes, set a todo reminder or file a bug if appropriate)**
No, has expiry -
Does the data collection use a third-party collection tool? If yes, escalate to legal.
No
app/metrics.yaml
Outdated
A user toggled a preference switch in settings | ||
extra_keys: | ||
preferenceKey: | ||
description: "The preference key for the switch preference the user toggled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking about if this needs all possible values - it would be helpful for whomever is looking at this from a data perspective to know what the values are (on the other hand, these are values that we're including that might just get out of date). Slight preference for adding those values though!
context.getString(R.string.pref_key_show_search_suggestions), | ||
context.getString(R.string.pref_key_show_visited_sites_bookmarks), | ||
context.getString(R.string.pref_key_remote_debugging), | ||
context.getString(R.string.pref_key_telemetry), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess technically we won't ever receive this telemetry getting toggled off, but not important enough to exclude.
ffc533a
to
0aa1154
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'd put a safe call on Context where you call track ().
|
||
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener { sharedPreferences, key -> | ||
try { | ||
context!!.components.analytics.metrics.track(Event.PreferenceToggled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is safe because onCreate comes right after onAttach, but I don't think we should crash if context is null here.
@@ -71,6 +74,29 @@ sealed class Event { | |||
object CustomTabsActionTapped : Event() | |||
object CustomTabsMenuOpened : Event() | |||
|
|||
data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() { | |||
private val switchPreferenceTelemetryAllowList = listOf( | |||
context.getString(R.string.pref_key_leakcanary), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So every single preference toggle needs to grab all of these keys from resources? I rather wish there was a way to do this only once and remember the set or list, but this will do for now.
0aa1154
to
6b00fc5
Compare
Pull Request checklist