mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] Switch to the typed API for Glean events
Required for Glean v52.0.0 Ref https://github.com/mozilla-mobile/fenix/issues/19967
This commit is contained in:
parent
18141bffa3
commit
0a0234bc6f
@ -7555,26 +7555,33 @@ engine_tab:
|
||||
description: |
|
||||
Number of active tabs (with an engine session assigned) when the app
|
||||
went to the background.
|
||||
type: string
|
||||
background_crashed_tabs:
|
||||
description: |
|
||||
Number of tabs marked as crashed when the app went to the background.
|
||||
type: string
|
||||
background_total_tabs:
|
||||
description: |
|
||||
Number of total tabs when the app went to the background.
|
||||
type: string
|
||||
foreground_active_tabs:
|
||||
description: |
|
||||
Number of active tabs (with an engine session assigned) when the
|
||||
app came back to the foreground.
|
||||
type: string
|
||||
foreground_crashed_tabs:
|
||||
description: |
|
||||
Number of tabs marked as crashed when the app came back to the
|
||||
foreground.
|
||||
type: string
|
||||
foreground_total_tabs:
|
||||
description: |
|
||||
Number of total tabs when the app came back to the foreground.
|
||||
type: string
|
||||
time_in_background:
|
||||
description: |
|
||||
Time (in milliseconds) the app was in the background.
|
||||
type: string
|
||||
metadata:
|
||||
tags:
|
||||
- Performance
|
||||
|
@ -10,7 +10,7 @@ import androidx.lifecycle.LifecycleOwner
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.support.base.android.Clock
|
||||
import org.mozilla.fenix.GleanMetrics.EngineTab as EngineMetrics
|
||||
import org.mozilla.fenix.GleanMetrics.EngineTab.foregroundMetricsKeys as MetricsKeys
|
||||
import org.mozilla.fenix.GleanMetrics.EngineTab.ForegroundMetricsExtra as MetricsExtra
|
||||
|
||||
/**
|
||||
* [LifecycleObserver] to used on the process lifecycle to measure the amount of tabs getting killed
|
||||
@ -33,17 +33,15 @@ class TelemetryLifecycleObserver(
|
||||
val lastState = pausedState ?: return
|
||||
val currentState = createTabState()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
// FIXME(#19967): Migrate to non-deprecated API.
|
||||
EngineMetrics.foregroundMetrics.record(
|
||||
mapOf(
|
||||
MetricsKeys.backgroundActiveTabs to lastState.activeEngineTabs.toString(),
|
||||
MetricsKeys.backgroundCrashedTabs to lastState.crashedTabs.toString(),
|
||||
MetricsKeys.backgroundTotalTabs to lastState.totalTabs.toString(),
|
||||
MetricsKeys.foregroundActiveTabs to currentState.activeEngineTabs.toString(),
|
||||
MetricsKeys.foregroundCrashedTabs to currentState.crashedTabs.toString(),
|
||||
MetricsKeys.foregroundTotalTabs to currentState.totalTabs.toString(),
|
||||
MetricsKeys.timeInBackground to (currentState.timestamp - lastState.timestamp).toString(),
|
||||
MetricsExtra(
|
||||
backgroundActiveTabs = lastState.activeEngineTabs.toString(),
|
||||
backgroundCrashedTabs = lastState.crashedTabs.toString(),
|
||||
backgroundTotalTabs = lastState.totalTabs.toString(),
|
||||
foregroundActiveTabs = currentState.activeEngineTabs.toString(),
|
||||
foregroundCrashedTabs = currentState.crashedTabs.toString(),
|
||||
foregroundTotalTabs = currentState.totalTabs.toString(),
|
||||
timeInBackground = (currentState.timestamp - lastState.timestamp).toString(),
|
||||
),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user