Skip to content

Commit

Permalink
Bug 1892230 - Fenix: Use delayPingLifetimeIo=true to batch db writes …
Browse files Browse the repository at this point in the history
…in memory r=TravisLong,android-reviewers,twhite a=pascalc

This buffers metric recordings in memory and flushes them to disk periodically.

Differential Revision: https://phabricator.services.mozilla.com/D212288
  • Loading branch information
badboy committed Jun 3, 2024
1 parent b002e56 commit 67c33db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import mozilla.telemetry.glean.config.Configuration as GleanCoreConfiguration
* @property channel (optional )the release channel the application is on, if known. This will be
* sent along with all the pings, in the `client_info` section.
* @property maxEvents (optional) the number of events to store before the events ping is sent
* @property enableEventTimestamps (Experimental) Whether to add a wallclock timestamp to all events.
* @property delayPingLifetimeIo Whether Glean should delay persistence of data from metrics with ping lifetime.
*/
data class Configuration @JvmOverloads constructor(
val httpClient: PingUploader,
val serverEndpoint: String = DEFAULT_TELEMETRY_ENDPOINT,
val channel: String? = null,
val maxEvents: Int? = null,
val enableEventTimestamps: Boolean = false,
val delayPingLifetimeIo: Boolean = false,
) {
// The following is required to support calling our API from Java.
companion object {
Expand All @@ -45,6 +48,7 @@ data class Configuration @JvmOverloads constructor(
maxEvents = maxEvents,
httpClient = httpClient,
enableEventTimestamps = enableEventTimestamps,
delayPingLifetimeIo = delayPingLifetimeIo,
)
}
}
5 changes: 5 additions & 0 deletions mobile/android/fenix/app/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ features:

glean:
description: "A feature that provides server-side configurations for Glean metrics (aka Server Knobs)."
allow-coenrollment: true
variables:
metrics-enabled:
description: "A map of metric base-identifiers to booleans representing the state of the 'enabled' flag for that metric."
Expand All @@ -257,6 +258,10 @@ features:
description: "Enables precise event timestamps for Glean events"
type: Boolean
default: false
delay-ping-lifetime-io:
description: "Glean will delay io for ping lifetime metrics"
type: Boolean
default: true

splash-screen:
description: "A feature that extends splash screen duration, allowing additional data fetching time for the app's initial run."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
lazy(LazyThreadSafetyMode.NONE) { components.core.client },
),
enableEventTimestamps = FxNimbus.features.glean.value().enableEventTimestamps,
delayPingLifetimeIo = FxNimbus.features.glean.value().delayPingLifetimeIo,
)

// Set the metric configuration from Nimbus.
Expand Down

0 comments on commit 67c33db

Please sign in to comment.