android-components / mozilla.components.service.glean.private / TimingDistributionMetricType

TimingDistributionMetricType

data class TimingDistributionMetricType : CommonMetricData, HistogramMetricBase (source)

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.

Constructors

Name Summary
<init> TimingDistributionMetricType(disabled: Boolean, category: String, lifetime: Lifetime, name: String, sendInPings: List<String>, timeUnit: TimeUnit)
This implements the developer facing API for recording timing distribution metrics.

Properties

Name Summary
category val category: String
disabled val disabled: Boolean
lifetime val lifetime: Lifetime
name val name: String
sendInPings val sendInPings: List<String>
timeUnit val timeUnit: TimeUnit

Inherited Properties

Name Summary
identifier open val identifier: String

Functions

Name Summary
accumulateSamples fun accumulateSamples(samples: LongArray): Unit
Accumulates the provided samples in the metric.
cancel fun cancel(timerId: GleanTimerId?): Unit
Abort a previous start call. No error is recorded if no start was called.
start fun start(): GleanTimerId?
Start tracking time for the provided metric and GleanTimerId. This records an error if it’s already tracking time (i.e. start was already called with no corresponding stopAndAccumulate): in that case the original start time will be preserved.
stopAndAccumulate fun stopAndAccumulate(timerId: GleanTimerId?): Unit
Stop tracking time for the provided metric and associated timer id. Add a count to the corresponding bucket in the timing distribution. This will record an error if no start was called.
testGetValue fun testGetValue(pingName: String = sendInPings.first()): FunctionalHistogram
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.
testHasValue fun testHasValue(pingName: String = sendInPings.first()): Boolean
Tests whether a value is stored for the metric 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.

Inherited Functions

Name Summary
shouldRecord open fun shouldRecord(logger: Logger): Boolean