For #1242: Adds telemetry for error pages
parent
0080e7d701
commit
aa9e5c46ae
|
@ -263,7 +263,6 @@ quick_action_sheet:
|
||||||
data_reviews:
|
data_reviews:
|
||||||
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
- https://github.com/mozilla-mobile/fenix/pull/1362#issuecomment-479668466
|
||||||
notification_emails:
|
notification_emails:
|
||||||
|
|
||||||
- fenix-core@mozilla.com
|
- fenix-core@mozilla.com
|
||||||
expires: "2020-03-01"
|
expires: "2020-03-01"
|
||||||
share_tapped:
|
share_tapped:
|
||||||
|
@ -717,4 +716,20 @@ library:
|
||||||
- https://github.com/mozilla-mobile/fenix/pull/2538#issuecomment-492830242
|
- https://github.com/mozilla-mobile/fenix/pull/2538#issuecomment-492830242
|
||||||
notification_emails:
|
notification_emails:
|
||||||
- fenix-core@mozilla.com
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-03-01"
|
||||||
|
|
||||||
|
error_page:
|
||||||
|
visited_error:
|
||||||
|
type: event
|
||||||
|
description: >
|
||||||
|
A user encountered an error page
|
||||||
|
extra_keys:
|
||||||
|
error_type:
|
||||||
|
description: "The error type of the error page encountered"
|
||||||
|
bugs:
|
||||||
|
- 1242
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/2491#issuecomment-492414486
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
expires: "2020-03-01"
|
expires: "2020-03-01"
|
|
@ -9,6 +9,7 @@ import mozilla.components.browser.errorpages.ErrorPages
|
||||||
import mozilla.components.browser.errorpages.ErrorType
|
import mozilla.components.browser.errorpages.ErrorType
|
||||||
import mozilla.components.concept.engine.EngineSession
|
import mozilla.components.concept.engine.EngineSession
|
||||||
import mozilla.components.concept.engine.request.RequestInterceptor
|
import mozilla.components.concept.engine.request.RequestInterceptor
|
||||||
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
import org.mozilla.fenix.exceptions.ExceptionDomains
|
import org.mozilla.fenix.exceptions.ExceptionDomains
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.utils.Settings
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
@ -45,11 +46,11 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
|
||||||
errorType: ErrorType,
|
errorType: ErrorType,
|
||||||
uri: String?
|
uri: String?
|
||||||
): RequestInterceptor.ErrorResponse? {
|
): RequestInterceptor.ErrorResponse? {
|
||||||
|
|
||||||
val riskLevel = getRiskLevel(errorType)
|
val riskLevel = getRiskLevel(errorType)
|
||||||
val htmlResource = getPageForRiskLevel(riskLevel)
|
val htmlResource = getPageForRiskLevel(riskLevel)
|
||||||
val cssResource = getStyleForRiskLevel(riskLevel)
|
val cssResource = getStyleForRiskLevel(riskLevel)
|
||||||
|
|
||||||
|
context.components.analytics.metrics.track(Event.ErrorPageVisited(errorType))
|
||||||
return RequestInterceptor.ErrorResponse(
|
return RequestInterceptor.ErrorResponse(
|
||||||
ErrorPages
|
ErrorPages
|
||||||
.createErrorPage(context, errorType, uri = uri, htmlResource = htmlResource, cssResource = cssResource)
|
.createErrorPage(context, errorType, uri = uri, htmlResource = htmlResource, cssResource = cssResource)
|
||||||
|
|
|
@ -25,6 +25,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.mozilla.fenix.GleanMetrics.QrScanner
|
import org.mozilla.fenix.GleanMetrics.QrScanner
|
||||||
import org.mozilla.fenix.GleanMetrics.Library
|
import org.mozilla.fenix.GleanMetrics.Library
|
||||||
|
import org.mozilla.fenix.GleanMetrics.ErrorPage
|
||||||
|
|
||||||
private class EventWrapper<T : Enum<T>>(
|
private class EventWrapper<T : Enum<T>>(
|
||||||
private val recorder: ((Map<T, String>?) -> Unit),
|
private val recorder: ((Map<T, String>?) -> Unit),
|
||||||
|
@ -183,6 +184,10 @@ private val Event.wrapper
|
||||||
{ Library.selectedItem },
|
{ Library.selectedItem },
|
||||||
{ Library.selectedItemKeys.valueOf(it) }
|
{ Library.selectedItemKeys.valueOf(it) }
|
||||||
)
|
)
|
||||||
|
is Event.ErrorPageVisited -> EventWrapper(
|
||||||
|
{ ErrorPage.visitedError },
|
||||||
|
{ ErrorPage.visitedErrorKeys.valueOf(it) }
|
||||||
|
)
|
||||||
|
|
||||||
// Don't track other events with Glean
|
// Don't track other events with Glean
|
||||||
else -> null
|
else -> null
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package org.mozilla.fenix.components.metrics
|
package org.mozilla.fenix.components.metrics
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import mozilla.components.browser.errorpages.ErrorType
|
||||||
import mozilla.components.browser.search.SearchEngine
|
import mozilla.components.browser.search.SearchEngine
|
||||||
import mozilla.components.support.base.Component
|
import mozilla.components.support.base.Component
|
||||||
import mozilla.components.support.base.facts.Fact
|
import mozilla.components.support.base.facts.Fact
|
||||||
|
@ -110,6 +111,11 @@ sealed class Event {
|
||||||
get() = mapOf("source" to item)
|
get() = mapOf("source" to item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class ErrorPageVisited(val errorType: ErrorType) : Event() {
|
||||||
|
override val extras: Map<String, String>?
|
||||||
|
get() = mapOf("errorType" to errorType.name)
|
||||||
|
}
|
||||||
|
|
||||||
data class SearchBarTapped(val source: Source) : Event() {
|
data class SearchBarTapped(val source: Source) : Event() {
|
||||||
enum class Source { HOME, BROWSER }
|
enum class Source { HOME, BROWSER }
|
||||||
override val extras: Map<String, String>?
|
override val extras: Map<String, String>?
|
||||||
|
|
Loading…
Reference in New Issue