diff --git a/app/metrics.yaml b/app/metrics.yaml index 53e09d98e..8e05f3c86 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -3885,12 +3885,13 @@ startup.timeline: time_unit: millisecond description: | The duration the Android framework takes to start before letting us run - code in `*Application.init` when this device has `clock_ticks_per_second` - equal to 100: if it's not equal to 100, then this value is captured in - `framework_secondary`. We split this into two metrics to make it easier - to analyze in GLAM. We split on 100 because when we did our initial brief - analysis - https://sql.telemetry.mozilla.org/queries/75591 - the results - for clocks ticks were overwhelmingly 100. + code in `*Application.init` when this device has + `clock_ticks_per_second_v2` equal to 100: if it's not equal to 100, then + this value is captured in `framework_secondary`. We split this into two + metrics to make it easier to analyze in GLAM. We split on 100 because + when we did our initial brief analysis - + https://sql.telemetry.mozilla.org/queries/75591 - the results for clocks + ticks were overwhelmingly 100. The duration is calculated from `appInitTimestamp - processStartTimestamp`. `processStartTimestamp` is derived from the clock @@ -3898,8 +3899,8 @@ startup.timeline: Therefore, we convert and round our timestamps to clock ticks before computing the difference and convert back to nanoseconds to report. - For debugging purposes, `clock_ticks_per_second`, which may vary between - devices, is also reported as a metric + For debugging purposes, `clock_ticks_per_second_v2`, which may vary + between devices, is also reported as a metric bugs: - https://github.com/mozilla-mobile/fenix/issues/8803 - https://github.com/mozilla-mobile/fenix/issues/17972 @@ -3920,8 +3921,9 @@ startup.timeline: time_unit: millisecond description: | The duration the Android framework takes to start before letting us run - code in `*Application.init` when this device has `clock_ticks_per_second` - not equal to 100. For more details on this metric, see `framework_primary` + code in `*Application.init` when this device has + `clock_ticks_per_second_v2` not equal to 100. For more details on this + metric, see `framework_primary` bugs: - https://github.com/mozilla-mobile/fenix/issues/17972 data_reviews: @@ -3970,19 +3972,22 @@ startup.timeline: - perf-android-fe@mozilla.com - mcomella@mozilla.com expires: "2021-08-01" - clock_ticks_per_second: + clock_ticks_per_second_v2: send_in_pings: - startup-timeline - type: counter + type: quantity + unit: clock ticks per second description: | The number of clock tick time units that occur in one second on this particular device. This value is expected to be used in conjunction with - the `framework_start` metric. + the `framework_primary/secondary` metrics. bugs: - https://github.com/mozilla-mobile/fenix/issues/8803 + - https://github.com/mozilla-mobile/fenix/issues/18157 data_reviews: - https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626 - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 + - https://github.com/mozilla-mobile/fenix/pull/18158#issue-579593943 data_sensitivity: - technical notification_emails: diff --git a/app/src/main/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurement.kt b/app/src/main/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurement.kt index 47953d9b7..a63f0bb61 100644 --- a/app/src/main/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurement.kt +++ b/app/src/main/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurement.kt @@ -57,7 +57,7 @@ internal class StartupFrameworkStartMeasurement( val clockTicksPerSecond = stat.clockTicksPerSecond.also { // framework* is derived from the number of clock ticks per second. To ensure this // value does not throw off our result, we capture it too. - telemetry.clockTicksPerSecond.add(it.toInt()) + telemetry.clockTicksPerSecondV2.set(it) } // In our brief analysis, clock ticks per second was overwhelmingly equal to 100. To make diff --git a/app/src/test/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurementTest.kt b/app/src/test/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurementTest.kt index fa465b2fb..76c32c3ad 100644 --- a/app/src/test/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurementTest.kt +++ b/app/src/test/java/org/mozilla/fenix/perf/StartupFrameworkStartMeasurementTest.kt @@ -11,7 +11,7 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import io.mockk.verify import mozilla.components.service.glean.private.BooleanMetricType -import mozilla.components.service.glean.private.CounterMetricType +import mozilla.components.service.glean.private.QuantityMetricType import mozilla.components.service.glean.private.TimespanMetricType import org.junit.Before import org.junit.Test @@ -31,7 +31,7 @@ class StartupFrameworkStartMeasurementTest { @MockK(relaxed = true) private lateinit var frameworkPrimary: TimespanMetricType @MockK(relaxed = true) private lateinit var frameworkSecondary: TimespanMetricType @MockK(relaxed = true) private lateinit var frameworkStartError: BooleanMetricType - @MockK(relaxed = true) private lateinit var clockTicksPerSecond: CounterMetricType + @MockK(relaxed = true) private lateinit var clockTicksPerSecondV2: QuantityMetricType private var clockTicksPerSecondValue = -1L @@ -57,7 +57,7 @@ class StartupFrameworkStartMeasurementTest { every { telemetry.frameworkPrimary } returns frameworkPrimary every { telemetry.frameworkSecondary } returns frameworkSecondary every { telemetry.frameworkStartError } returns frameworkStartError - every { telemetry.clockTicksPerSecond } returns clockTicksPerSecond + every { telemetry.clockTicksPerSecondV2 } returns clockTicksPerSecondV2 metrics = StartupFrameworkStartMeasurement(stat, telemetry, getElapsedRealtimeNanos) } @@ -131,7 +131,7 @@ class StartupFrameworkStartMeasurementTest { val (setMetric, unsetMetric) = getSetAndUnsetMetric(isPrimary) verify(exactly = 1) { setMetric.setRawNanos(any()) } verify { unsetMetric wasNot Called } - verify(exactly = 1) { clockTicksPerSecond.add(any()) } + verify(exactly = 1) { clockTicksPerSecondV2.set(any()) } verify { frameworkStartError wasNot Called } } @@ -150,7 +150,7 @@ class StartupFrameworkStartMeasurementTest { verify { unsetMetric wasNot Called } val expectedClockTicksPerSecond = getExpectedClockTicksPerSecond(isPrimary) - verify { clockTicksPerSecond.add(expectedClockTicksPerSecond.toInt()) } + verify { clockTicksPerSecondV2.set(expectedClockTicksPerSecond) } verify { frameworkStartError wasNot Called } } @@ -158,7 +158,7 @@ class StartupFrameworkStartMeasurementTest { verify { frameworkStartError.set(true) } verify { frameworkPrimary wasNot Called } verify { frameworkSecondary wasNot Called } - verify { clockTicksPerSecond wasNot Called } + verify { clockTicksPerSecondV2 wasNot Called } } private fun getSetAndUnsetMetric(isPrimary: Boolean): Pair { diff --git a/docs/metrics.md b/docs/metrics.md index 5abd72251..24bdcb0df 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -370,9 +370,9 @@ The following metrics are added to the ping: | Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) | | --- | --- | --- | --- | --- | --- | --- | -| startup.timeline.clock_ticks_per_second |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |The number of clock tick time units that occur in one second on this particular device. This value is expected to be used in conjunction with the `framework_start` metric. |[1](https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1 | -| startup.timeline.framework_primary |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |The duration the Android framework takes to start before letting us run code in `*Application.init` when this device has `clock_ticks_per_second` equal to 100: if it's not equal to 100, then this value is captured in `framework_secondary`. We split this into two metrics to make it easier to analyze in GLAM. We split on 100 because when we did our initial brief analysis - https://sql.telemetry.mozilla.org/queries/75591 - the results for clocks ticks were overwhelmingly 100. The duration is calculated from `appInitTimestamp - processStartTimestamp`. `processStartTimestamp` is derived from the clock tick time unit, which is expected to be less granular than nanoseconds. Therefore, we convert and round our timestamps to clock ticks before computing the difference and convert back to nanoseconds to report. For debugging purposes, `clock_ticks_per_second`, which may vary between devices, is also reported as a metric |[1](https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068), [3](https://github.com/mozilla-mobile/fenix/pull/18043#issue-575389284)||2021-08-01 |1 | -| startup.timeline.framework_secondary |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |The duration the Android framework takes to start before letting us run code in `*Application.init` when this device has `clock_ticks_per_second` not equal to 100. For more details on this metric, see `framework_primary` |[1](https://github.com/mozilla-mobile/fenix/pull/18043#issue-575389284)||2021-08-01 |1 | +| startup.timeline.clock_ticks_per_second_v2 |[quantity](https://mozilla.github.io/glean/book/user/metrics/quantity.html) |The number of clock tick time units that occur in one second on this particular device. This value is expected to be used in conjunction with the `framework_primary/secondary` metrics. |[1](https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068), [3](https://github.com/mozilla-mobile/fenix/pull/18158#issue-579593943)||2021-08-01 |1 | +| startup.timeline.framework_primary |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |The duration the Android framework takes to start before letting us run code in `*Application.init` when this device has `clock_ticks_per_second_v2` equal to 100: if it's not equal to 100, then this value is captured in `framework_secondary`. We split this into two metrics to make it easier to analyze in GLAM. We split on 100 because when we did our initial brief analysis - https://sql.telemetry.mozilla.org/queries/75591 - the results for clocks ticks were overwhelmingly 100. The duration is calculated from `appInitTimestamp - processStartTimestamp`. `processStartTimestamp` is derived from the clock tick time unit, which is expected to be less granular than nanoseconds. Therefore, we convert and round our timestamps to clock ticks before computing the difference and convert back to nanoseconds to report. For debugging purposes, `clock_ticks_per_second_v2`, which may vary between devices, is also reported as a metric |[1](https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068), [3](https://github.com/mozilla-mobile/fenix/pull/18043#issue-575389284)||2021-08-01 |1 | +| startup.timeline.framework_secondary |[timespan](https://mozilla.github.io/glean/book/user/metrics/timespan.html) |The duration the Android framework takes to start before letting us run code in `*Application.init` when this device has `clock_ticks_per_second_v2` not equal to 100. For more details on this metric, see `framework_primary` |[1](https://github.com/mozilla-mobile/fenix/pull/18043#issue-575389284)||2021-08-01 |1 | | startup.timeline.framework_start_error |[boolean](https://mozilla.github.io/glean/book/user/metrics/boolean.html) |An error when attempting to record `framework_primary/secondary` - the application init timestamp returned a negative value - which is likely indicative of a bug in the implementation. |[1](https://github.com/mozilla-mobile/fenix/pull/9788#pullrequestreview-394228626), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1 | | startup.timeline.framework_start_read_error |[boolean](https://mozilla.github.io/glean/book/user/metrics/boolean.html) |An error when attempting to read stats from /proc pseudo-filesystem - privacy managers can block access to reading these files - the application will catch a file reading exception. |[1](https://github.com/mozilla-mobile/fenix/pull/10481), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1 |