Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #4421: Fixes issues with new glean events
Browse files Browse the repository at this point in the history
  • Loading branch information
sblatz committed Aug 19, 2019
1 parent 7d02354 commit 57ebed5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
11 changes: 11 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,17 @@ sync_auth:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
sign_up:
type: event
description: >
A user signed up for a new FxA account
bugs:
- 4421
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4816
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
scan_pairing:
type: event
description: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class CreateCollectionFragment : DialogFragment() {
}

context.components.analytics.metrics.track(
Event.CollectionSaved(context.components.core.sessionManager.size, sessionBundle.size)
Event.CollectionSaved(normalSessionSize(), sessionBundle.size)
)

closeTabsIfNecessary(it.tabs)
Expand All @@ -137,7 +137,7 @@ class CreateCollectionFragment : DialogFragment() {
}

context.components.analytics.metrics.track(
Event.CollectionTabsAdded(context.components.core.sessionManager.size, sessionBundle.size)
Event.CollectionTabsAdded(normalSessionSize(), sessionBundle.size)
)

closeTabsIfNecessary(it.tabs)
Expand All @@ -154,6 +154,12 @@ class CreateCollectionFragment : DialogFragment() {
}
}

private fun normalSessionSize(): Int {
return requireComponents.core.sessionManager.sessions.filter { session ->
(!session.isCustomTabSession() && !session.private)
}.size
}

private fun handleBackPress(backPressFrom: SaveCollectionStep) {
when (backPressFrom) {
SaveCollectionStep.SelectTabs -> dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ private val Event.wrapper
is Event.SyncAuthSignOut -> EventWrapper<NoExtraKeys>(
{ SyncAuth.signOut.record(it) }
)
is Event.FXANewSignup -> EventWrapper<NoExtraKeys>(
{ SyncAuth.signUp.record(it) }
)
is Event.SyncAuthScanPairing -> EventWrapper<NoExtraKeys>(
{ SyncAuth.scanPairing.record(it) }
)
Expand Down Expand Up @@ -300,9 +303,6 @@ private val Event.wrapper
is Event.SearchWidgetVoiceSearchPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidget.voiceButton.record(it) }
)
is Event.FXANewSignup -> EventWrapper<NoExtraKeys>(
{ Collections.renameButton.record(it) }
)

// Don't track other events with Glean
else -> null
Expand Down
16 changes: 16 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,22 @@ tracking_protection</td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>sign_out</td>
<td>event</td>
<td>A user pressed the sign out button on the sync account page and was successfully signed out of FxA</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>sign_up</td>
<td>event</td>
<td> A user signed up for a new FxA account</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4816#issuecomment-522643217">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>scan_pairing</td>
<td>event</td>
Expand Down

0 comments on commit 57ebed5

Please sign in to comment.