glean / mozilla.telemetry.glean.private / UuidMetricType

UuidMetricType

class UuidMetricType

This implements the developer facing API for recording UUID 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 UUID API exposes the generateAndSet and set methods.

The internal constructor is only used by LabeledMetricType directly.

Constructors

<init>

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

The public constructor used by automatically generated metrics.

UuidMetricType(handle: Long, disabled: Boolean, sendInPings: List<String>)

This implements the developer facing API for recording UUID metrics.

Functions

generateAndSet

fun generateAndSet(): UUID?

Generate a new UUID value and set it in the metric store.

set

fun set(value: UUID): Unit

Explicitly set an existing UUID value

testGetValue

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

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.