Loading app/metrics.yaml +19 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,25 @@ events: notification_emails: - fenix-core@mozilla.com expires: "2021-08-01" normal_and_private_uri_count: type: counter description: | A counter of URIs visited by the user in the current session, including page reloads. This includes private browsing. This does not include background page requests and URIs from embedded pages but may be incremented without user interaction by website scripts that programmatically redirect to a new location. send_in_pings: - metrics bugs: - https://github.com/mozilla-mobile/fenix/issues/17089 data_reviews: - https://github.com/mozilla-mobile/fenix/pull/17935 data_sensitivity: - interaction notification_emails: - fenix-core@mozilla.com expires: "2022-08-01" preference_toggled: type: event description: | Loading app/src/main/java/org/mozilla/fenix/TelemetryMiddleware.kt +7 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ class TelemetryMiddleware( } } @Suppress("TooGenericExceptionCaught", "ComplexMethod") @Suppress("TooGenericExceptionCaught", "ComplexMethod", "NestedBlockDepth") override fun invoke( context: MiddlewareContext<BrowserState, BrowserAction>, next: (BrowserAction) -> Unit, Loading @@ -66,9 +66,13 @@ class TelemetryMiddleware( is ContentAction.UpdateLoadingStateAction -> { context.state.findTab(action.sessionId)?.let { tab -> // Record UriOpened event when a non-private page finishes loading if (tab.content.loading && !action.loading && !tab.content.private) { if (tab.content.loading && !action.loading) { if (!tab.content.private) { metrics.track(Event.UriOpened) } metrics.track(Event.NormalAndPrivateUriOpened) } } } is ContentAction.UpdateLoadRequestAction -> { Loading app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ sealed class Event { object CustomTabsActionTapped : Event() object CustomTabsMenuOpened : Event() object UriOpened : Event() object NormalAndPrivateUriOpened : Event() object SyncAuthOpened : Event() object SyncAuthClosed : Event() object SyncAuthSignUp : Event() Loading app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +3 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,9 @@ private val Event.wrapper: EventWrapper<*>? is Event.UriOpened -> EventWrapper<NoExtraKeys>( { Events.totalUriCount.add(1) } ) is Event.NormalAndPrivateUriOpened -> EventWrapper<NoExtraKeys>( { Events.normalAndPrivateUriCount.add(1) } ) is Event.ErrorPageVisited -> EventWrapper( { ErrorPage.visitedError.record(it) }, { ErrorPage.visitedErrorKeys.valueOf(it) } Loading app/src/test/java/org/mozilla/fenix/TelemetryMiddlewareTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -182,9 +182,11 @@ class TelemetryMiddlewareTest { store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking() store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, true)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 0) { metrics.track(Event.NormalAndPrivateUriOpened) } store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, false)).joinBlocking() verify(exactly = 1) { metrics.track(Event.UriOpened) } verify(exactly = 1) { metrics.track(Event.NormalAndPrivateUriOpened) } } @Test Loading @@ -193,9 +195,11 @@ class TelemetryMiddlewareTest { store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking() store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, true)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 0) { metrics.track(Event.NormalAndPrivateUriOpened) } store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, false)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 1) { metrics.track(Event.NormalAndPrivateUriOpened) } } @Test Loading Loading
app/metrics.yaml +19 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,25 @@ events: notification_emails: - fenix-core@mozilla.com expires: "2021-08-01" normal_and_private_uri_count: type: counter description: | A counter of URIs visited by the user in the current session, including page reloads. This includes private browsing. This does not include background page requests and URIs from embedded pages but may be incremented without user interaction by website scripts that programmatically redirect to a new location. send_in_pings: - metrics bugs: - https://github.com/mozilla-mobile/fenix/issues/17089 data_reviews: - https://github.com/mozilla-mobile/fenix/pull/17935 data_sensitivity: - interaction notification_emails: - fenix-core@mozilla.com expires: "2022-08-01" preference_toggled: type: event description: | Loading
app/src/main/java/org/mozilla/fenix/TelemetryMiddleware.kt +7 −3 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ class TelemetryMiddleware( } } @Suppress("TooGenericExceptionCaught", "ComplexMethod") @Suppress("TooGenericExceptionCaught", "ComplexMethod", "NestedBlockDepth") override fun invoke( context: MiddlewareContext<BrowserState, BrowserAction>, next: (BrowserAction) -> Unit, Loading @@ -66,9 +66,13 @@ class TelemetryMiddleware( is ContentAction.UpdateLoadingStateAction -> { context.state.findTab(action.sessionId)?.let { tab -> // Record UriOpened event when a non-private page finishes loading if (tab.content.loading && !action.loading && !tab.content.private) { if (tab.content.loading && !action.loading) { if (!tab.content.private) { metrics.track(Event.UriOpened) } metrics.track(Event.NormalAndPrivateUriOpened) } } } is ContentAction.UpdateLoadRequestAction -> { Loading
app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +1 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ sealed class Event { object CustomTabsActionTapped : Event() object CustomTabsMenuOpened : Event() object UriOpened : Event() object NormalAndPrivateUriOpened : Event() object SyncAuthOpened : Event() object SyncAuthClosed : Event() object SyncAuthSignUp : Event() Loading
app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +3 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,9 @@ private val Event.wrapper: EventWrapper<*>? is Event.UriOpened -> EventWrapper<NoExtraKeys>( { Events.totalUriCount.add(1) } ) is Event.NormalAndPrivateUriOpened -> EventWrapper<NoExtraKeys>( { Events.normalAndPrivateUriCount.add(1) } ) is Event.ErrorPageVisited -> EventWrapper( { ErrorPage.visitedError.record(it) }, { ErrorPage.visitedErrorKeys.valueOf(it) } Loading
app/src/test/java/org/mozilla/fenix/TelemetryMiddlewareTest.kt +4 −0 Original line number Diff line number Diff line Loading @@ -182,9 +182,11 @@ class TelemetryMiddlewareTest { store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking() store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, true)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 0) { metrics.track(Event.NormalAndPrivateUriOpened) } store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, false)).joinBlocking() verify(exactly = 1) { metrics.track(Event.UriOpened) } verify(exactly = 1) { metrics.track(Event.NormalAndPrivateUriOpened) } } @Test Loading @@ -193,9 +195,11 @@ class TelemetryMiddlewareTest { store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking() store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, true)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 0) { metrics.track(Event.NormalAndPrivateUriOpened) } store.dispatch(ContentAction.UpdateLoadingStateAction(tab.id, false)).joinBlocking() verify(exactly = 0) { metrics.track(Event.UriOpened) } verify(exactly = 1) { metrics.track(Event.NormalAndPrivateUriOpened) } } @Test Loading