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


data class LabeledMetricType<T> : CommonMetricData (source)

This implements the developer facing API for labeled 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.

Unlike most metric types, LabeledMetricType does not have its own corresponding storage engine, but records metrics for the underlying metric type T in the storage engine for that type. The only difference is that labeled metrics are stored with the special key $category.$name/$label. The |StorageEngineManager.collect| method knows how to pull these special values back out of the individual storage engines and rearrange them correctly in the ping.


Name Summary
<init> LabeledMetricType(disabled: Boolean, category: String, lifetime: Lifetime, name: String, sendInPings: List<String>, subMetric: T, labels: Set<String>? = null)
This implements the developer facing API for labeled metrics.


Name Summary
category val category: String
disabled val disabled: Boolean
labels val labels: Set<String>?
lifetime val lifetime: Lifetime
name val name: String
sendInPings val sendInPings: List<String>
subMetric val subMetric: T

Inherited Properties

Name Summary
identifier open val identifier: String


Name Summary
get operator fun get(label: String): T
Get the specific metric for a given label.operator fun get(labelIndex: Int): T
Get the specific metric for a given label index.

Inherited Functions

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