glean / mozilla.telemetry.glean.private / JweMetricType

JweMetricType

class JweMetricType

This implements the developer facing API for recording JWE 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 JWE API exposes the set and setWithCompactRepresentation methods, which take care of validating the input data.

Constructors

<init>

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

The public constructor used by automatically generated metrics.

Functions

set

fun set(header: String, key: String, initVector: String, cipherText: String, authTag: String): Unit

Build a JWE value from its elements and set to it.

setWithCompactRepresentation

fun setWithCompactRepresentation(value: String): Unit

Set a JWE value.

testGetCompactRepresentation

fun testGetCompactRepresentation(pingName: String = sendInPings.first()): String

Returns the stored value in the compact representation 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.

testGetNumRecordedErrors

fun testGetNumRecordedErrors(errorType: ErrorType, pingName: String = sendInPings.first()): Int

Returns the number of errors recorded for the given metric.

testGetValue

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

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.