Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding telemetry for regenerating a logins encryption key #4613

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ Use the template below to make assigning a version number during the release cut
reported in [#4575](https://github.com/mozilla/application-services/issues/4575). This is
technically a breaking change as a dictionary described in the UDL changed, but in practice,
none of our consumers used it, so we are not declaring it as breaking in this context.

## Logins

### What's New

- Added support for recording telemetry when the logins encryption key needs to be regenerated.
44 changes: 44 additions & 0 deletions components/logins/android/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,50 @@
$schema: moz://mozilla.org/schemas/glean/metrics/1-0-0

logins_store:
# These track when we need to regenerate the encryption key which causes all
# local data to be lost
key_regenerated_lost:
type: event
description: >
The encryption key was regenerated because it was lost
bugs:
- https://github.com/mozilla/application-services/issues/4554
data_reviews:
- https://github.com/mozilla/application-services/issues/4582
data_sensitivity:
- technical
notification_emails:
- [email protected]
expires: 2022-04-18

key_regenerated_corrupt:
type: event
description: >
The encryption key was regenerated because it didn't match the encrypted
data
bugs:
- https://github.com/mozilla/application-services/issues/4554
data_reviews:
- https://github.com/mozilla/application-services/issues/4582
data_sensitivity:
- technical
notification_emails:
- [email protected]
expires: 2022-04-18

key_regenerated_other:
type: event
description: >
The encryption key was regenerated for an unknown reason
bugs:
- https://github.com/mozilla/application-services/issues/4554
data_reviews:
- https://github.com/mozilla/application-services/issues/4582
data_sensitivity:
- technical
notification_emails:
- [email protected]
expires: 2022-04-18

# These help us understand how much the logins store is being used, and
# whether it's succeeding in the duties asked of it. We'll use them to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ fun recordMigrationMetrics(jsonString: String) {
}
}

enum class KeyRegenerationEventReason {
Lost, Corrupt, Other,
}

fun recordKeyRegenerationEvent(reason: KeyRegenerationEventReason) {
// Avoid the deprecation warning when calling `record()` without the optional EventExtras param
@Suppress("DEPRECATION")
when (reason) {
KeyRegenerationEventReason.Lost -> LoginsStoreMetrics.keyRegeneratedLost.record()
KeyRegenerationEventReason.Corrupt -> LoginsStoreMetrics.keyRegeneratedCorrupt.record()
KeyRegenerationEventReason.Other -> LoginsStoreMetrics.keyRegeneratedOther.record()
}
}

/**
* A helper class for gathering basic count metrics on different kinds of LoginsStore operation.
*
Expand Down