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

CustomDistributionMetricType

data class CustomDistributionMetricType : CommonMetricData, HistogramMetricBase (source)

This implements the developer facing API for recording custom distribution metrics.

Custom distributions are histograms with the following parameters that are settable on a per-metric basis:

    - `rangeMin`/`rangeMax`: The minimum and maximum values
    - `bucketCount`: The number of histogram buckets
    - `histogramType`: Whether the bucketing is linear or exponential

This metric exists primarily for backward compatibility with histograms in legacy (pre-Glean) telemetry, and its use is not recommended for newly-created metrics.

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> CustomDistributionMetricType(disabled: Boolean, category: String, lifetime: Lifetime, name: String, sendInPings: List<String>, rangeMin: Long, rangeMax: Long, bucketCount: Int, histogramType: HistogramType)
This implements the developer facing API for recording custom distribution metrics.

Properties

Name Summary
bucketCount val bucketCount: Int
category val category: String
disabled val disabled: Boolean
histogramType val histogramType: HistogramType
lifetime val lifetime: Lifetime
name val name: String
rangeMax val rangeMax: Long
rangeMin val rangeMin: Long
sendInPings val sendInPings: List<String>

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.
testGetValue fun testGetValue(pingName: String = sendInPings.first()): PrecomputedHistogram
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