This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5932: Closes #5929: Emit facts during migration r=pocmo a=jonalmeida Co-authored-by: Jonathan Almeida <jalmeida@mozilla.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ts/support/migration/src/main/java/mozilla/components/support/migration/MigrationFacts.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.support.migration | ||
|
||
import mozilla.components.support.base.Component | ||
import mozilla.components.support.base.facts.Action | ||
import mozilla.components.support.base.facts.Fact | ||
import mozilla.components.support.base.facts.collect | ||
|
||
/** | ||
* Facts emitted for telemetry related to migration. | ||
*/ | ||
class MigrationFacts { | ||
|
||
/** | ||
* Items that specify which portion of the migration was invoked. | ||
*/ | ||
object Items { | ||
const val MIGRATION_COMPLETED = "migration_completed" | ||
const val MIGRATION_STARTED = "migration_started" | ||
} | ||
} | ||
|
||
private fun emitMigrationFact( | ||
action: Action, | ||
item: String | ||
) { | ||
Fact( | ||
Component.SUPPORT_MIGRATION, | ||
action, | ||
item | ||
).collect() | ||
} | ||
|
||
internal fun emitCompletedFact() = emitMigrationFact(Action.INTERACTION, MigrationFacts.Items.MIGRATION_COMPLETED) | ||
internal fun emitStartedFact() = emitMigrationFact(Action.INTERACTION, MigrationFacts.Items.MIGRATION_STARTED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters