diff --git a/components/support/sync-telemetry/docs/metrics.md b/components/support/sync-telemetry/docs/metrics.md index 40de93439bd..5c66caa2b8c 100644 --- a/components/support/sync-telemetry/docs/metrics.md +++ b/components/support/sync-telemetry/docs/metrics.md @@ -8,10 +8,40 @@ This means you might have to go searching through the dependency tree to get a f # Pings +- [addresses-sync](#addresses-sync) - [bookmarks-sync](#bookmarks-sync) +- [creditcards-sync](#creditcards-sync) - [history-sync](#history-sync) - [logins-sync](#logins-sync) - [sync](#sync) +- [tabs-sync](#tabs-sync) + +## addresses-sync + +A ping sent for every Addresses engine sync. It doesn't include the `client_id` because it reports a hashed version of the user's Firefox Account ID. + + +**Data reviews for this ping:** + +- + +**Bugs related to this ping:** + +- + +All Glean pings contain built-in metrics in the [`ping_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-ping_info-section) and [`client_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section) sections. + +In addition to those built-in metrics, the following metrics are added to the ping: + +| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) | +| --- | --- | --- | --- | --- | --- | --- | +| addresses_sync.failure_reason |[labeled_string](https://mozilla.github.io/glean/book/user/metrics/labeled_strings.html) |Records why the addresses sync failed: either due to an authentication error, unexpected exception, or other error. The error strings are truncated and sanitized to omit PII, like URLs and file system paths. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.finished_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the addresses sync finished. This includes the time to download, apply, and upload all records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.incoming |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records incoming addresses record counts. `applied` is the number of incoming records that were successfully stored or updated in the local database. `failed_to_apply` is the number of records that were ignored due to errors. `reconciled` is the number of merged records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.outgoing |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records outgoing addresses record counts. `uploaded` is the number of records that were successfully sent to the server. `failed_to_upload` is the number of records that weren't uploaded, and will be retried on the next sync. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.outgoing_batches |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |Records the number of batches needed to upload all outgoing records. The Sync server has a hard limit on the number of records (and request body bytes) on the number of records that can fit into a single batch, and large syncs may require multiple batches. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.started_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the addresses sync started. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| addresses_sync.uid |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The user's hashed Firefox Account ID. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | ## bookmarks-sync @@ -42,6 +72,33 @@ In addition to those built-in metrics, the following metrics are added to the pi | bookmarks_sync.uid |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The user's hashed Firefox Account ID. |[mozilla-mobile/android-components#3092](https://github.com/mozilla-mobile/android-components/pull/3092)||never |2 | | sync.sync_uuid |[uuid](https://mozilla.github.io/glean/book/user/metrics/uuid.html) |Unique identifier for this sync, used to correlate together individual pings for data types that were synchronized together (history, bookmarks, logins). If a data type is synchronized by itself via the legacy 'sync' API (as opposed to the Sync Manager), then this field will not be set on the corresponding ping. |[mozilla-mobile/android-components#5386](https://github.com/mozilla-mobile/android-components/pull/5386#pullrequestreview-392363687)||never |1 | +## creditcards-sync + +A ping sent for every Credit Cards engine sync. It doesn't include the `client_id` because it reports a hashed version of the user's Firefox Account ID. + + +**Data reviews for this ping:** + +- + +**Bugs related to this ping:** + +- + +All Glean pings contain built-in metrics in the [`ping_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-ping_info-section) and [`client_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section) sections. + +In addition to those built-in metrics, the following metrics are added to the ping: + +| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) | +| --- | --- | --- | --- | --- | --- | --- | +| creditcards_sync.failure_reason |[labeled_string](https://mozilla.github.io/glean/book/user/metrics/labeled_strings.html) |Records why the credit cards sync failed: either due to an authentication error, unexpected exception, or other error. The error strings are truncated and sanitized to omit PII, like URLs and file system paths. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • other
  • unexpected
  • auth
|never |2 | +| creditcards_sync.finished_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the credit cards sync finished. This includes the time to download, apply, and upload all records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| creditcards_sync.incoming |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records incoming credit cards record counts. `applied` is the number of incoming records that were successfully stored or updated in the local database. `failed_to_apply` is the number of records that were ignored due to errors. `reconciled` is the number of merged records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • applied
  • failed_to_apply
  • reconciled
|never |2 | +| creditcards_sync.outgoing |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records outgoing credit cards record counts. `uploaded` is the number of records that were successfully sent to the server. `failed_to_upload` is the number of records that weren't uploaded, and will be retried on the next sync. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • uploaded
  • failed_to_upload
|never |2 | +| creditcards_sync.outgoing_batches |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |Records the number of batches needed to upload all outgoing records. The Sync server has a hard limit on the number of records (and request body bytes) on the number of records that can fit into a single batch, and large syncs may require multiple batches. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| creditcards_sync.started_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the credit cards sync started. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| creditcards_sync.uid |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The user's hashed Firefox Account ID. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | + ## history-sync A ping sent for every history sync. It doesn't include the `client_id` because it reports a hashed version of the user's Firefox Account ID. @@ -122,6 +179,33 @@ In addition to those built-in metrics, the following metrics are added to the pi | sync.failure_reason |[labeled_string](https://mozilla.github.io/glean/book/user/metrics/labeled_strings.html) |Records a global sync failure: either due to an authentication error, unexpected exception, or other error that caused the sync to fail. Error strings are truncated and sanitized to omit PII, like URLs and file system paths. |[mozilla-mobile/android-components#3092](https://github.com/mozilla-mobile/android-components/pull/3092)|
  • other
  • unexpected
  • auth
|never |2 | | sync.sync_uuid |[uuid](https://mozilla.github.io/glean/book/user/metrics/uuid.html) |Unique identifier for this sync, used to correlate together individual pings for data types that were synchronized together (history, bookmarks, logins). If a data type is synchronized by itself via the legacy 'sync' API (as opposed to the Sync Manager), then this field will not be set on the corresponding ping. |[mozilla-mobile/android-components#5386](https://github.com/mozilla-mobile/android-components/pull/5386#pullrequestreview-392363687)||never |1 | +## tabs-sync + +A ping sent for every Tabs engine sync. It doesn't include the `client_id` because it reports a hashed version of the user's Firefox Account ID. + + +**Data reviews for this ping:** + +- + +**Bugs related to this ping:** + +- + +All Glean pings contain built-in metrics in the [`ping_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-ping_info-section) and [`client_info`](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section) sections. + +In addition to those built-in metrics, the following metrics are added to the ping: + +| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) | +| --- | --- | --- | --- | --- | --- | --- | +| tabs_sync.failure_reason |[labeled_string](https://mozilla.github.io/glean/book/user/metrics/labeled_strings.html) |Records why the tabs sync failed: either due to an authentication error, unexpected exception, or other error. The error strings are truncated and sanitized to omit PII, like URLs and file system paths. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • other
  • unexpected
  • auth
|never |2 | +| tabs_sync.finished_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the tabs sync finished. This includes the time to download, apply, and upload all records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| tabs_sync.incoming |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records incoming tabs record counts. `applied` is the number of incoming records that were successfully stored or updated in the local database. `failed_to_apply` is the number of records that were ignored due to errors. `reconciled` is the number of merged records. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • applied
  • failed_to_apply
  • reconciled
|never |2 | +| tabs_sync.outgoing |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records outgoing tabs record counts. `uploaded` is the number of records that were successfully sent to the server. `failed_to_upload` is the number of records that weren't uploaded, and will be retried on the next sync. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)|
  • uploaded
  • failed_to_upload
|never |2 | +| tabs_sync.outgoing_batches |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |Records the number of batches needed to upload all outgoing records. The Sync server has a hard limit on the number of records (and request body bytes) on the number of records that can fit into a single batch, and large syncs may require multiple batches. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| tabs_sync.started_at |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |Records when the tabs sync started. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | +| tabs_sync.uid |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The user's hashed Firefox Account ID. |[mozilla-mobile/android-components#10372](https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481)||never |2 | + Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection). diff --git a/components/support/sync-telemetry/metrics.yaml b/components/support/sync-telemetry/metrics.yaml index 55449087b10..540988f4005 100644 --- a/components/support/sync-telemetry/metrics.yaml +++ b/components/support/sync-telemetry/metrics.yaml @@ -54,8 +54,9 @@ sync: expires: never lifetime: ping -# `history-sync`, `logins-sync` and `bookmarks-sync` metrics -# all use the same structure, +# `history-sync`, `logins-sync`, `bookmarks-sync`, `creditcards-sync`, +# `addresses-sync` and `tabs-sync` metrics +# mostly use the same structure, with some minor variability, # but must be specified individually. We can't define them once and use # `send_in_pings` because the stores might be synced in parallel, and we can't # guarantee that a ping for one store would be sent before the others. @@ -491,6 +492,424 @@ bookmarks_sync: - sync-core@mozilla.com expires: never lifetime: ping + +creditcards_sync: + uid: + type: string + description: > + The user's hashed Firefox Account ID. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + started_at: + type: datetime + time_unit: millisecond + description: > + Records when the credit cards sync started. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + finished_at: + type: datetime + time_unit: millisecond + description: > + Records when the credit cards sync finished. This includes the time to + download, apply, and upload all records. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + incoming: + type: labeled_counter + labels: + - applied + - failed_to_apply + - reconciled + description: > + Records incoming credit cards record counts. `applied` is the number of + incoming records that were successfully stored or updated in the + local database. `failed_to_apply` is the number of records that were + ignored due to errors. `reconciled` is the number of merged records. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing: + type: labeled_counter + labels: + - uploaded + - failed_to_upload + description: > + Records outgoing credit cards record counts. `uploaded` is the number of + records that were successfully sent to the server. `failed_to_upload` + is the number of records that weren't uploaded, and will be retried + on the next sync. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing_batches: + type: counter + description: > + Records the number of batches needed to upload all outgoing records. The + Sync server has a hard limit on the number of records (and request body + bytes) on the number of records that can fit into a single batch, and + large syncs may require multiple batches. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + failure_reason: + type: labeled_string + labels: + - other + - unexpected + - auth + description: > + Records why the credit cards sync failed: either due to an authentication + error, unexpected exception, or other error. The error strings are + truncated and sanitized to omit PII, like URLs and file system paths. + send_in_pings: + - creditcards-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + +addresses_sync: + uid: + type: string + description: > + The user's hashed Firefox Account ID. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + started_at: + type: datetime + time_unit: millisecond + description: > + Records when the addresses sync started. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + finished_at: + type: datetime + time_unit: millisecond + description: > + Records when the addresses sync finished. This includes the time to + download, apply, and upload all records. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + incoming: + type: labeled_counter + labels: + - applied + - failed_to_apply + - reconciled + description: > + Records incoming addresses record counts. `applied` is the number of + incoming records that were successfully stored or updated in the + local database. `failed_to_apply` is the number of records that were + ignored due to errors. `reconciled` is the number of merged records. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing: + type: labeled_counter + labels: + - uploaded + - failed_to_upload + description: > + Records outgoing addresses record counts. `uploaded` is the number of + records that were successfully sent to the server. `failed_to_upload` + is the number of records that weren't uploaded, and will be retried + on the next sync. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing_batches: + type: counter + description: > + Records the number of batches needed to upload all outgoing records. The + Sync server has a hard limit on the number of records (and request body + bytes) on the number of records that can fit into a single batch, and + large syncs may require multiple batches. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + failure_reason: + type: labeled_string + labels: + - other + - unexpected + - auth + description: > + Records why the addresses sync failed: either due to an authentication + error, unexpected exception, or other error. The error strings are + truncated and sanitized to omit PII, like URLs and file system paths. + send_in_pings: + - addresses-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + +tabs_sync: + uid: + type: string + description: > + The user's hashed Firefox Account ID. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + started_at: + type: datetime + time_unit: millisecond + description: > + Records when the tabs sync started. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + finished_at: + type: datetime + time_unit: millisecond + description: > + Records when the tabs sync finished. This includes the time to + download, apply, and upload all records. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + incoming: + type: labeled_counter + labels: + - applied + - failed_to_apply + - reconciled + description: > + Records incoming tabs record counts. `applied` is the number of + incoming records that were successfully stored or updated in the + local database. `failed_to_apply` is the number of records that were + ignored due to errors. `reconciled` is the number of merged records. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing: + type: labeled_counter + labels: + - uploaded + - failed_to_upload + description: > + Records outgoing tabs record counts. `uploaded` is the number of + records that were successfully sent to the server. `failed_to_upload` + is the number of records that weren't uploaded, and will be retried + on the next sync. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + outgoing_batches: + type: counter + description: > + Records the number of batches needed to upload all outgoing records. The + Sync server has a hard limit on the number of records (and request body + bytes) on the number of records that can fit into a single batch, and + large syncs may require multiple batches. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + failure_reason: + type: labeled_string + labels: + - other + - unexpected + - auth + description: > + Records why the tabs sync failed: either due to an authentication + error, unexpected exception, or other error. The error strings are + truncated and sanitized to omit PII, like URLs and file system paths. + send_in_pings: + - tabs-sync + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 + data_sensitivity: + - interaction + notification_emails: + - sync-core@mozilla.com + expires: never + lifetime: ping + fxa_tab: sent: type: event diff --git a/components/support/sync-telemetry/pings.yaml b/components/support/sync-telemetry/pings.yaml index 825016df8d5..314c172bafb 100644 --- a/components/support/sync-telemetry/pings.yaml +++ b/components/support/sync-telemetry/pings.yaml @@ -63,3 +63,39 @@ logins-sync: - sync-core@mozilla.com data_reviews: - https://github.com/mozilla-mobile/android-components/pull/5294 +creditcards-sync: + description: > + A ping sent for every Credit Cards engine sync. + It doesn't include the `client_id` because it reports + a hashed version of the user's Firefox Account ID. + include_client_id: false + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + notification_emails: + - sync-core@mozilla.com + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 +addresses-sync: + description: > + A ping sent for every Addresses engine sync. + It doesn't include the `client_id` because it reports + a hashed version of the user's Firefox Account ID. + include_client_id: false + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + notification_emails: + - sync-core@mozilla.com + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 +tabs-sync: + description: > + A ping sent for every Tabs engine sync. + It doesn't include the `client_id` because it reports + a hashed version of the user's Firefox Account ID. + include_client_id: false + bugs: + - https://github.com/mozilla-mobile/android-components/issues/10371 + notification_emails: + - sync-core@mozilla.com + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/10372#issuecomment-850378481 diff --git a/components/support/sync-telemetry/src/main/java/mozilla/components/support/sync/telemetry/SyncTelemetry.kt b/components/support/sync-telemetry/src/main/java/mozilla/components/support/sync/telemetry/SyncTelemetry.kt index fdff1971c6a..b7ffba9e53c 100644 --- a/components/support/sync-telemetry/src/main/java/mozilla/components/support/sync/telemetry/SyncTelemetry.kt +++ b/components/support/sync-telemetry/src/main/java/mozilla/components/support/sync/telemetry/SyncTelemetry.kt @@ -12,10 +12,13 @@ import mozilla.components.concept.base.crash.CrashReporting import mozilla.components.service.glean.private.LabeledMetricType import mozilla.components.service.glean.private.StringMetricType import mozilla.components.support.base.log.logger.Logger +import mozilla.components.support.sync.telemetry.GleanMetrics.AddressesSync import mozilla.components.support.sync.telemetry.GleanMetrics.BookmarksSync +import mozilla.components.support.sync.telemetry.GleanMetrics.CreditcardsSync import mozilla.components.support.sync.telemetry.GleanMetrics.FxaTab import mozilla.components.support.sync.telemetry.GleanMetrics.HistorySync import mozilla.components.support.sync.telemetry.GleanMetrics.LoginsSync +import mozilla.components.support.sync.telemetry.GleanMetrics.TabsSync import mozilla.components.support.sync.telemetry.GleanMetrics.Pings import mozilla.components.support.sync.telemetry.GleanMetrics.Sync import org.json.JSONException @@ -41,6 +44,7 @@ object SyncTelemetry { /** * Process [SyncTelemetryPing] as returned from [mozilla.appservices.syncmanager.SyncManager]. */ + @Suppress("LongParameterList") fun processSyncTelemetry( syncTelemetry: SyncTelemetryPing, @@ -49,7 +53,10 @@ object SyncTelemetry { submitGlobalPing: () -> Unit = { Pings.sync.submit() }, submitHistoryPing: () -> Unit = { Pings.historySync.submit() }, submitBookmarksPing: () -> Unit = { Pings.bookmarksSync.submit() }, - submitLoginsPing: () -> Unit = { Pings.loginsSync.submit() } + submitLoginsPing: () -> Unit = { Pings.loginsSync.submit() }, + submitCreditCardsPing: () -> Unit = { Pings.creditcardsSync.submit() }, + submitAddressesPing: () -> Unit = { Pings.addressesSync.submit() }, + submitTabsPing: () -> Unit = { Pings.tabsSync.submit() } ) { syncTelemetry.syncs.forEach { syncInfo -> // Note that `syncUuid` is configured to be submitted in all of the sync pings (it's set @@ -84,6 +91,18 @@ object SyncTelemetry { individualLoginsSync(syncTelemetry.uid, engineInfo) submitLoginsPing() } + "creditcards" -> { + individualCreditCardsSync(syncTelemetry.uid, engineInfo) + submitCreditCardsPing() + } + "addresses" -> { + individualAddressesSync(syncTelemetry.uid, engineInfo) + submitAddressesPing() + } + "tabs" -> { + individualTabsSync(syncTelemetry.uid, engineInfo) + submitTabsPing() + } else -> logger.warn("Ignoring telemetry for engine ${engineInfo.name}") } } @@ -286,6 +305,114 @@ object SyncTelemetry { } } + @Suppress("ComplexMethod") + private fun individualCreditCardsSync(hashedFxaUid: String, engineInfo: EngineInfo) { + require(engineInfo.name == "creditcards") { "Expected 'creditcards', got ${engineInfo.name}" } + + CreditcardsSync.apply { + val base = BaseGleanSyncPing.fromEngineInfo(hashedFxaUid, engineInfo) + uid.set(base.uid) + startedAt.set(base.startedAt) + finishedAt.set(base.finishedAt) + if (base.applied > 0) { + // Since all Sync ping counters have `lifetime: ping`, and + // we send the ping immediately after, we don't need to + // reset the counters before calling `add`. + incoming["applied"].add(base.applied) + } + if (base.failedToApply > 0) { + incoming["failed_to_apply"].add(base.failedToApply) + } + if (base.reconciled > 0) { + incoming["reconciled"].add(base.reconciled) + } + if (base.uploaded > 0) { + outgoing["uploaded"].add(base.uploaded) + } + if (base.failedToUpload > 0) { + outgoing["failed_to_upload"].add(base.failedToUpload) + } + if (base.outgoingBatches > 0) { + outgoingBatches.add(base.outgoingBatches) + } + base.failureReason?.let { + recordFailureReason(it, failureReason) + } + } + } + + @Suppress("ComplexMethod") + private fun individualAddressesSync(hashedFxaUid: String, engineInfo: EngineInfo) { + require(engineInfo.name == "addresses") { "Expected 'addresses', got ${engineInfo.name}" } + + AddressesSync.apply { + val base = BaseGleanSyncPing.fromEngineInfo(hashedFxaUid, engineInfo) + uid.set(base.uid) + startedAt.set(base.startedAt) + finishedAt.set(base.finishedAt) + if (base.applied > 0) { + // Since all Sync ping counters have `lifetime: ping`, and + // we send the ping immediately after, we don't need to + // reset the counters before calling `add`. + incoming["applied"].add(base.applied) + } + if (base.failedToApply > 0) { + incoming["failed_to_apply"].add(base.failedToApply) + } + if (base.reconciled > 0) { + incoming["reconciled"].add(base.reconciled) + } + if (base.uploaded > 0) { + outgoing["uploaded"].add(base.uploaded) + } + if (base.failedToUpload > 0) { + outgoing["failed_to_upload"].add(base.failedToUpload) + } + if (base.outgoingBatches > 0) { + outgoingBatches.add(base.outgoingBatches) + } + base.failureReason?.let { + recordFailureReason(it, failureReason) + } + } + } + + @Suppress("ComplexMethod") + private fun individualTabsSync(hashedFxaUid: String, engineInfo: EngineInfo) { + require(engineInfo.name == "tabs") { "Expected 'tabs', got ${engineInfo.name}" } + + TabsSync.apply { + val base = BaseGleanSyncPing.fromEngineInfo(hashedFxaUid, engineInfo) + uid.set(base.uid) + startedAt.set(base.startedAt) + finishedAt.set(base.finishedAt) + if (base.applied > 0) { + // Since all Sync ping counters have `lifetime: ping`, and + // we send the ping immediately after, we don't need to + // reset the counters before calling `add`. + incoming["applied"].add(base.applied) + } + if (base.failedToApply > 0) { + incoming["failed_to_apply"].add(base.failedToApply) + } + if (base.reconciled > 0) { + incoming["reconciled"].add(base.reconciled) + } + if (base.uploaded > 0) { + outgoing["uploaded"].add(base.uploaded) + } + if (base.failedToUpload > 0) { + outgoing["failed_to_upload"].add(base.failedToUpload) + } + if (base.outgoingBatches > 0) { + outgoingBatches.add(base.outgoingBatches) + } + base.failureReason?.let { + recordFailureReason(it, failureReason) + } + } + } + private fun recordFailureReason(reason: FailureReason, failureReasonMetric: LabeledMetricType) { val metric = when (reason.name) { FailureName.Other, FailureName.Unknown -> failureReasonMetric["other"]