1
0
Fork 0

For #11392: Rename Installation ping to FirstSession (#11869)

master
Sawyer Blatz 2020-06-25 10:06:26 -07:00 committed by GitHub
parent e4fe83daff
commit 2d65faf232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 29 deletions

View File

@ -2319,11 +2319,11 @@ pocket:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-09-01" expires: "2020-09-01"
installation: first_session:
campaign: campaign:
type: string type: string
send_in_pings: send_in_pings:
- installation - first-session
description: | description: |
The name of the campaign that is responsible for this installation. The name of the campaign that is responsible for this installation.
bugs: bugs:
@ -2336,7 +2336,7 @@ installation:
network: network:
type: string type: string
send_in_pings: send_in_pings:
- installation - first-session
description: | description: |
The name of the Network that sourced this installation. The name of the Network that sourced this installation.
bugs: bugs:
@ -2349,7 +2349,7 @@ installation:
adgroup: adgroup:
type: string type: string
send_in_pings: send_in_pings:
- installation - first-session
description: | description: |
The name of the AdGroup that was used to source this installation. The name of the AdGroup that was used to source this installation.
bugs: bugs:
@ -2361,7 +2361,7 @@ installation:
expires: "2020-09-01" expires: "2020-09-01"
creative: creative:
send_in_pings: send_in_pings:
- installation - first-session
type: string type: string
description: | description: |
The identifier of the creative material that the user interacted with. The identifier of the creative material that the user interacted with.
@ -2374,7 +2374,7 @@ installation:
expires: "2020-09-01" expires: "2020-09-01"
timestamp: timestamp:
send_in_pings: send_in_pings:
- installation - first-session
type: datetime type: datetime
description: | description: |
The Glean generated date and time of the installation. This is The Glean generated date and time of the installation. This is

View File

@ -19,9 +19,10 @@ activation:
notification_emails: notification_emails:
- fenix-core@mozilla.com - fenix-core@mozilla.com
installation: first-session:
description: | description: |
This ping is intended to capture the source of the installation This ping is intended to capture the source of the app install
on the first session.
include_client_id: true include_client_id: true
bugs: bugs:
- https://github.com/mozilla-mobile/fenix/issues/7295 - https://github.com/mozilla-mobile/fenix/issues/7295

View File

@ -37,7 +37,7 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
true true
) )
val installationPing = InstallationPing(application) val installationPing = FirstSessionPing(application)
config.setOnAttributionChangedListener { config.setOnAttributionChangedListener {
if (!it.network.isNullOrEmpty()) { if (!it.network.isNullOrEmpty()) {

View File

@ -11,11 +11,11 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import mozilla.components.support.base.log.logger.Logger import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.GleanMetrics.Installation import org.mozilla.fenix.GleanMetrics.FirstSession
import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
class InstallationPing(private val context: Context) { class FirstSessionPing(private val context: Context) {
private val prefs: SharedPreferences by lazy { private val prefs: SharedPreferences by lazy {
context.getSharedPreferences( context.getSharedPreferences(
@ -56,15 +56,15 @@ class InstallationPing(private val context: Context) {
internal fun triggerPing() { internal fun triggerPing() {
if (checkMetricsNotEmpty()) { if (checkMetricsNotEmpty()) {
context.settings().also { context.settings().also {
Installation.campaign.set(it.adjustCampaignId) FirstSession.campaign.set(it.adjustCampaignId)
Installation.adgroup.set(it.adjustAdGroup) FirstSession.adgroup.set(it.adjustAdGroup)
Installation.creative.set(it.adjustCreative) FirstSession.creative.set(it.adjustCreative)
Installation.network.set(it.adjustNetwork) FirstSession.network.set(it.adjustNetwork)
Installation.timestamp.set() FirstSession.timestamp.set()
} }
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
Pings.installation.submit() Pings.firstSession.submit()
markAsTriggered() markAsTriggered()
} }
} }

View File

@ -570,7 +570,7 @@ class GleanMetricsService(private val context: Context) : MetricsService {
private var initialized = false private var initialized = false
private val activationPing = ActivationPing(context) private val activationPing = ActivationPing(context)
private val installationPing = InstallationPing(context) private val installationPing = FirstSessionPing(context)
override fun start() { override fun start() {
logger.debug("Enabling Glean.") logger.debug("Enabling Glean.")

View File

@ -16,7 +16,7 @@ import org.junit.Test
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.Settings
internal class InstallationPingTest { internal class FirstSessionPingTest {
@Test @Test
fun `checkAndSend() triggers the ping if it wasn't marked as triggered`() { fun `checkAndSend() triggers the ping if it wasn't marked as triggered`() {
@ -24,7 +24,7 @@ internal class InstallationPingTest {
val mockedSettings: Settings = mockk(relaxed = true) val mockedSettings: Settings = mockk(relaxed = true)
mockkStatic("org.mozilla.fenix.ext.ContextKt") mockkStatic("org.mozilla.fenix.ext.ContextKt")
every { mockedContext.settings() } returns mockedSettings every { mockedContext.settings() } returns mockedSettings
val mockAp = spyk(InstallationPing(mockedContext), recordPrivateCalls = true) val mockAp = spyk(FirstSessionPing(mockedContext), recordPrivateCalls = true)
every { mockAp.checkMetricsNotEmpty() } returns true every { mockAp.checkMetricsNotEmpty() } returns true
every { mockAp.wasAlreadyTriggered() } returns false every { mockAp.wasAlreadyTriggered() } returns false
every { mockAp.markAsTriggered() } just Runs every { mockAp.markAsTriggered() } just Runs
@ -39,7 +39,7 @@ internal class InstallationPingTest {
@Test @Test
fun `checkAndSend() doesn't trigger the ping again if it was marked as triggered`() { fun `checkAndSend() doesn't trigger the ping again if it was marked as triggered`() {
val mockAp = spyk(InstallationPing(mockk()), recordPrivateCalls = true) val mockAp = spyk(FirstSessionPing(mockk()), recordPrivateCalls = true)
every { mockAp.wasAlreadyTriggered() } returns true every { mockAp.wasAlreadyTriggered() } returns true
mockAp.checkAndSend() mockAp.checkAndSend()

View File

@ -9,7 +9,7 @@ This means you might have to go searching through the dependency tree to get a f
- [activation](#activation) - [activation](#activation)
- [events](#events) - [events](#events)
- [installation](#installation) - [first-session](#first-session)
- [metrics](#metrics) - [metrics](#metrics)
- [startup-timeline](#startup-timeline) - [startup-timeline](#startup-timeline)
@ -188,9 +188,10 @@ The following metrics are added to the ping:
| user_specified_search_engines.custom_engine_deleted |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user deleted a custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-09-01 | | user_specified_search_engines.custom_engine_deleted |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user deleted a custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-09-01 |
| voice_search.tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user selected the voice search button on the search screen. |[1](https://github.com/mozilla-mobile/fenix/pull/10785)||2020-09-01 | | voice_search.tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user selected the voice search button on the search screen. |[1](https://github.com/mozilla-mobile/fenix/pull/10785)||2020-09-01 |
## installation ## first-session
This ping is intended to capture the source of the installation This ping is intended to capture the source of the app install
on the first session.
This ping includes the [client id](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section). This ping includes the [client id](https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section).
@ -207,11 +208,11 @@ The following metrics are added to the ping:
| Name | Type | Description | Data reviews | Extras | Expiration | | Name | Type | Description | Data reviews | Extras | Expiration |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| installation.adgroup |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the AdGroup that was used to source this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586480836)||2020-09-01 | | first_session.adgroup |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the AdGroup that was used to source this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586480836)||2020-09-01 |
| installation.campaign |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the campaign that is responsible for this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 | | first_session.campaign |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the campaign that is responsible for this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
| installation.creative |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The identifier of the creative material that the user interacted with. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 | | first_session.creative |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The identifier of the creative material that the user interacted with. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
| installation.network |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the Network that sourced this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 | | first_session.network |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the Network that sourced this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
| installation.timestamp |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |The Glean generated date and time of the installation. This is unique per app install, though the rest of the data in this ping is from Adjust and will remain static across installs. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 | | first_session.timestamp |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |The Glean generated date and time of the installation. This is unique per app install, though the rest of the data in this ping is from Adjust and will remain static across installs. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
## metrics ## metrics