Closes #263: Integrate service-glean component.
parent
9876970b16
commit
7d807f5a0a
|
@ -1,3 +1,7 @@
|
||||||
|
plugins {
|
||||||
|
id "com.jetbrains.python.envs" version "0.0.26"
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
@ -119,7 +123,9 @@ dependencies {
|
||||||
implementation Deps.mozilla_feature_session
|
implementation Deps.mozilla_feature_session
|
||||||
implementation Deps.mozilla_feature_toolbar
|
implementation Deps.mozilla_feature_toolbar
|
||||||
implementation Deps.mozilla_feature_tabs
|
implementation Deps.mozilla_feature_tabs
|
||||||
|
|
||||||
implementation Deps.mozilla_service_fretboard
|
implementation Deps.mozilla_service_fretboard
|
||||||
|
implementation Deps.mozilla_service_glean
|
||||||
|
|
||||||
implementation Deps.mozilla_support_ktx
|
implementation Deps.mozilla_support_ktx
|
||||||
|
|
||||||
|
@ -152,4 +158,15 @@ android.applicationVariants.all { variant ->
|
||||||
} else {
|
} else {
|
||||||
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Activating telemetry only if command line parameter was provided (in automation)
|
||||||
|
if (project.hasProperty("telemetry") && project.property("telemetry") == "true") {
|
||||||
|
buildConfigField 'boolean', 'TELEMETRY', 'true'
|
||||||
|
} else {
|
||||||
|
buildConfigField 'boolean', 'TELEMETRY', 'false'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normally this should use the same version as the glean dependency. But since we are currently using AC snapshots we
|
||||||
|
// can't reference a git tag with a specific version here. So we are just using "master" and hoping for the best.
|
||||||
|
apply from: 'https://github.com/mozilla-mobile/android-components/raw/master/components/service/glean/scripts/sdk_generator.gradle'
|
||||||
|
|
|
@ -13,6 +13,7 @@ import mozilla.components.service.fretboard.Fretboard
|
||||||
import mozilla.components.service.fretboard.ValuesProvider
|
import mozilla.components.service.fretboard.ValuesProvider
|
||||||
import mozilla.components.service.fretboard.source.kinto.KintoExperimentSource
|
import mozilla.components.service.fretboard.source.kinto.KintoExperimentSource
|
||||||
import mozilla.components.service.fretboard.storage.flatfile.FlatFileExperimentStorage
|
import mozilla.components.service.fretboard.storage.flatfile.FlatFileExperimentStorage
|
||||||
|
import mozilla.components.service.glean.Glean
|
||||||
import mozilla.components.support.base.log.Log
|
import mozilla.components.support.base.log.Log
|
||||||
import mozilla.components.support.base.log.logger.Logger
|
import mozilla.components.support.base.log.logger.Logger
|
||||||
import mozilla.components.support.base.log.sink.AndroidLogSink
|
import mozilla.components.support.base.log.sink.AndroidLogSink
|
||||||
|
@ -29,9 +30,15 @@ class FenixApplication : Application() {
|
||||||
Log.addSink(AndroidLogSink())
|
Log.addSink(AndroidLogSink())
|
||||||
|
|
||||||
setupCrashReporting()
|
setupCrashReporting()
|
||||||
|
setupGlean(this)
|
||||||
loadExperiments()
|
loadExperiments()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupGlean(context: Context) {
|
||||||
|
Glean.initialize(context)
|
||||||
|
Glean.setMetricsEnabled(BuildConfig.TELEMETRY)
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadExperiments() {
|
private fun loadExperiments() {
|
||||||
val experimentsFile = File(filesDir, EXPERIMENTS_JSON_FILENAME)
|
val experimentsFile = File(filesDir, EXPERIMENTS_JSON_FILENAME)
|
||||||
val experimentSource = KintoExperimentSource(
|
val experimentSource = KintoExperimentSource(
|
||||||
|
|
|
@ -75,6 +75,7 @@ object Deps {
|
||||||
const val mozilla_feature_toolbar = "org.mozilla.components:feature-toolbar:${Versions.mozilla_android_components}"
|
const val mozilla_feature_toolbar = "org.mozilla.components:feature-toolbar:${Versions.mozilla_android_components}"
|
||||||
|
|
||||||
const val mozilla_service_fretboard = "org.mozilla.components:service-fretboard:${Versions.mozilla_android_components}"
|
const val mozilla_service_fretboard = "org.mozilla.components:service-fretboard:${Versions.mozilla_android_components}"
|
||||||
|
const val mozilla_service_glean = "org.mozilla.components:service-glean:${Versions.mozilla_android_components}"
|
||||||
|
|
||||||
const val mozilla_lib_crash = "org.mozilla.components:lib-crash:${Versions.mozilla_android_components}"
|
const val mozilla_lib_crash = "org.mozilla.components:lib-crash:${Versions.mozilla_android_components}"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Telemetry
|
||||||
|
|
||||||
|
Nightly versions of Fenix (build on Taskcluster) send a "baseline" ping to Mozilla's telemetry service.
|
||||||
|
|
||||||
|
## Baseline ping
|
||||||
|
|
||||||
|
Fenix crates and tries to send a "baseline" ping when the app goes to the background. This baseline ping is defined by the [Glean](https://github.com/mozilla-mobile/android-components/tree/master/components/service/glean) component and [documented in the Android Components repository](https://github.com/mozilla-mobile/android-components/blob/master/components/service/glean/docs/baseline.md).
|
Loading…
Reference in New Issue