glean / mozilla.telemetry.glean.private / BooleanMetricType

BooleanMetricType

class BooleanMetricType

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

The boolean API only exposes the set method.

The internal constructor is only used by LabeledMetricType directly.

Constructors

<init>

BooleanMetricType(disabled: Boolean, category: String, lifetime: Lifetime, name: String, sendInPings: List<String>)

The public constructor used by automatically generated metrics.

Functions

set

fun set(value: Boolean): Unit

Set a boolean value.

testGetValue

fun testGetValue(pingName: String = sendInPings.first()): Boolean

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.