diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /mobile/android/android-components/components/service/glean | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/android-components/components/service/glean')
3 files changed, 9 insertions, 86 deletions
diff --git a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/Glean.kt b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/Glean.kt index 232ac1b83f..2990220b31 100644 --- a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/Glean.kt +++ b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/Glean.kt @@ -116,8 +116,8 @@ object Glean { * * @param enabled Map of metrics' enabled state. */ - fun setMetricsEnabledConfig(enabled: Map<String, Boolean>) { - GleanCore.setMetricsEnabledConfig(JSONObject(enabled).toString()) + fun applyServerKnobsConfig(enabled: Map<String, Boolean>) { + GleanCore.applyServerKnobsConfig(JSONObject(enabled).toString()) } /** diff --git a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/config/Configuration.kt b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/config/Configuration.kt index 11911c7046..382078d3c9 100644 --- a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/config/Configuration.kt +++ b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/config/Configuration.kt @@ -19,6 +19,8 @@ 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, @@ -26,6 +28,7 @@ data class Configuration @JvmOverloads constructor( 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 { @@ -45,6 +48,7 @@ data class Configuration @JvmOverloads constructor( maxEvents = maxEvents, httpClient = httpClient, enableEventTimestamps = enableEventTimestamps, + delayPingLifetimeIo = delayPingLifetimeIo, ) } } diff --git a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/private/MetricAliases.kt b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/private/MetricAliases.kt index e6e0be9424..b98af6a480 100644 --- a/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/private/MetricAliases.kt +++ b/mobile/android/android-components/components/service/glean/src/main/java/mozilla/components/service/glean/private/MetricAliases.kt @@ -4,8 +4,6 @@ package mozilla.components.service.glean.private -import androidx.annotation.VisibleForTesting - typealias CommonMetricData = mozilla.telemetry.glean.private.CommonMetricData typealias EventExtras = mozilla.telemetry.glean.private.EventExtras typealias Lifetime = mozilla.telemetry.glean.private.Lifetime @@ -18,12 +16,14 @@ typealias CounterMetricType = mozilla.telemetry.glean.private.CounterMetricType typealias CustomDistributionMetricType = mozilla.telemetry.glean.private.CustomDistributionMetricType typealias DatetimeMetricType = mozilla.telemetry.glean.private.DatetimeMetricType typealias DenominatorMetricType = mozilla.telemetry.glean.private.DenominatorMetricType +typealias EventMetricType<T> = mozilla.telemetry.glean.private.EventMetricType<T> typealias HistogramMetricBase = mozilla.telemetry.glean.private.HistogramBase typealias HistogramType = mozilla.telemetry.glean.private.HistogramType typealias LabeledMetricType<T> = mozilla.telemetry.glean.private.LabeledMetricType<T> typealias MemoryDistributionMetricType = mozilla.telemetry.glean.private.MemoryDistributionMetricType typealias MemoryUnit = mozilla.telemetry.glean.private.MemoryUnit typealias NumeratorMetricType = mozilla.telemetry.glean.private.NumeratorMetricType +typealias ObjectSerialize = mozilla.telemetry.glean.private.ObjectSerialize typealias PingType<T> = mozilla.telemetry.glean.private.PingType<T> typealias QuantityMetricType = mozilla.telemetry.glean.private.QuantityMetricType typealias RateMetricType = mozilla.telemetry.glean.private.RateMetricType @@ -31,89 +31,8 @@ typealias RecordedExperiment = mozilla.telemetry.glean.private.RecordedExperimen typealias StringListMetricType = mozilla.telemetry.glean.private.StringListMetricType typealias StringMetricType = mozilla.telemetry.glean.private.StringMetricType typealias TextMetricType = mozilla.telemetry.glean.private.TextMetricType -typealias TimeUnit = mozilla.telemetry.glean.private.TimeUnit typealias TimespanMetricType = mozilla.telemetry.glean.private.TimespanMetricType +typealias TimeUnit = mozilla.telemetry.glean.private.TimeUnit typealias TimingDistributionMetricType = mozilla.telemetry.glean.private.TimingDistributionMetricType typealias UrlMetricType = mozilla.telemetry.glean.private.UrlMetricType typealias UuidMetricType = mozilla.telemetry.glean.private.UuidMetricType - -// FIXME(bug 1885170): Wrap the Glean SDK `EventMetricType` to overwrite the `testGetValue` function. -/** - * This implements the developer facing API for recording events. - * - * Instances of this class type are automatically generated by the parsers at built time, - * allowing developers to record events that were previously registered in the metrics.yaml file. - * - * The Events API only exposes the [record] method, which takes care of validating the input - * data and making sure that limits are enforced. - */ -class EventMetricType<ExtraObject> internal constructor( - private var inner: mozilla.telemetry.glean.private.EventMetricType<ExtraObject>, -) where ExtraObject : EventExtras { - /** - * The public constructor used by automatically generated metrics. - */ - constructor(meta: CommonMetricData, allowedExtraKeys: List<String>) : - this(inner = mozilla.telemetry.glean.private.EventMetricType(meta, allowedExtraKeys)) - - /** - * Record an event by using the information provided by the instance of this class. - * - * @param extra The event extra properties. - * Values are converted to strings automatically - * This is used for events where additional richer context is needed. - * The maximum length for values is 100 bytes. - * - * Note: `extra` is not optional here to avoid overlapping with the above definition of `record`. - * If no `extra` data is passed the above function will be invoked correctly. - */ - fun record(extra: ExtraObject? = null) { - inner.record(extra) - } - - /** - * Returns the stored value for testing purposes only. This function will attempt to await the - * last task (if any) writing to the the metric's storage engine before returning a value. - * - * @param pingName represents the name of the ping to retrieve the metric for. - * Defaults to the first value in `sendInPings`. - * @return value of the stored events - */ - @VisibleForTesting(otherwise = VisibleForTesting.NONE) - @JvmOverloads - fun testGetValue(pingName: String? = null): List<mozilla.telemetry.glean.private.RecordedEvent>? { - var events = inner.testGetValue(pingName) - if (events == null) { - return events - } - - // Remove the `glean_timestamp` extra. - // This is added by Glean and does not need to be exposed to testing. - for (event in events) { - if (event.extra == null) { - continue - } - - // We know it's not null - var map = event.extra!!.toMutableMap() - map.remove("glean_timestamp") - if (map.isEmpty()) { - event.extra = null - } else { - event.extra = map - } - } - - return events - } - - /** - * Returns the number of errors recorded for the given metric. - * - * @param errorType The type of the error recorded. - * @return the number of errors recorded for the metric. - */ - @VisibleForTesting(otherwise = VisibleForTesting.NONE) - fun testGetNumRecordedErrors(errorType: mozilla.components.service.glean.testing.ErrorType) = - inner.testGetNumRecordedErrors(errorType) -} |