Loading components/service/glean/src/main/java/mozilla/components/service/glean/private/HistogramBase.kt +0 −6 Original line number Diff line number Diff line Loading @@ -12,12 +12,6 @@ interface HistogramBase { /** * Accumulates the provided samples in the metric. * * Please note that this assumes that the provided samples are already in the * "unit" declared by the instance of the implementing metric type (e.g. if the * implementing class is a [TimingDistributionMetricType] and the instance this * method was called on is using [TimeUnit.Second], then `samples` are assumed * to be in that unit). * * @param samples the [LongArray] holding the samples to be recorded by the metric. */ fun accumulateSamples(samples: LongArray) Loading components/service/glean/src/main/java/mozilla/components/service/glean/private/TimingDistributionMetricType.kt +16 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,13 @@ import mozilla.components.support.base.log.logger.Logger /** * This implements the developer facing API for recording timing distribution metrics. * * The `timeUnit` parameter is only used when the values are set directly * through `accumulateSamples`, which is used for bringing in GeckoView metrics, * and not for normal use. * * To prevent the number of buckets from being unbounded, timings longer than 10 minutes * are truncated to 10 minutes. * * Instances of this class type are automatically generated by the parsers at build time, * allowing developers to record values that were previously registered in the metrics.yaml file. */ Loading Loading @@ -84,6 +91,15 @@ data class TimingDistributionMetricType( TimingManager.cancel(this, timerId) } /** * Accumulates the provided samples in the metric. * * Please note that this assumes that the provided samples are in `timeUnit` * and will be converted to nanoseconds for storage and sending in the ping. * * @param samples the [LongArray] holding the samples to be recorded by the metric, in * the unit specified by `timeUnit`. */ override fun accumulateSamples(samples: LongArray) { if (!shouldRecord(logger)) { return Loading components/service/glean/src/main/java/mozilla/components/service/glean/storages/TimingDistributionsStorageEngine.kt +2 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,8 @@ internal open class TimingDistributionsStorageEngineImplementation( ) : GenericStorageEngine<TimingDistributionData>() { companion object { // Maximum time of 10 minutes in nanoseconds // Maximum time of 10 minutes in nanoseconds. This maximum means we // retain a maximum of 313 buckets. internal const val MAX_SAMPLE_TIME: Long = 1000L * 1000L * 1000L * 60L * 10L } Loading Loading
components/service/glean/src/main/java/mozilla/components/service/glean/private/HistogramBase.kt +0 −6 Original line number Diff line number Diff line Loading @@ -12,12 +12,6 @@ interface HistogramBase { /** * Accumulates the provided samples in the metric. * * Please note that this assumes that the provided samples are already in the * "unit" declared by the instance of the implementing metric type (e.g. if the * implementing class is a [TimingDistributionMetricType] and the instance this * method was called on is using [TimeUnit.Second], then `samples` are assumed * to be in that unit). * * @param samples the [LongArray] holding the samples to be recorded by the metric. */ fun accumulateSamples(samples: LongArray) Loading
components/service/glean/src/main/java/mozilla/components/service/glean/private/TimingDistributionMetricType.kt +16 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,13 @@ import mozilla.components.support.base.log.logger.Logger /** * This implements the developer facing API for recording timing distribution metrics. * * The `timeUnit` parameter is only used when the values are set directly * through `accumulateSamples`, which is used for bringing in GeckoView metrics, * and not for normal use. * * To prevent the number of buckets from being unbounded, timings longer than 10 minutes * are truncated to 10 minutes. * * Instances of this class type are automatically generated by the parsers at build time, * allowing developers to record values that were previously registered in the metrics.yaml file. */ Loading Loading @@ -84,6 +91,15 @@ data class TimingDistributionMetricType( TimingManager.cancel(this, timerId) } /** * Accumulates the provided samples in the metric. * * Please note that this assumes that the provided samples are in `timeUnit` * and will be converted to nanoseconds for storage and sending in the ping. * * @param samples the [LongArray] holding the samples to be recorded by the metric, in * the unit specified by `timeUnit`. */ override fun accumulateSamples(samples: LongArray) { if (!shouldRecord(logger)) { return Loading
components/service/glean/src/main/java/mozilla/components/service/glean/storages/TimingDistributionsStorageEngine.kt +2 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,8 @@ internal open class TimingDistributionsStorageEngineImplementation( ) : GenericStorageEngine<TimingDistributionData>() { companion object { // Maximum time of 10 minutes in nanoseconds // Maximum time of 10 minutes in nanoseconds. This maximum means we // retain a maximum of 313 buckets. internal const val MAX_SAMPLE_TIME: Long = 1000L * 1000L * 1000L * 60L * 10L } Loading