android-components / mozilla.components.service.glean / EventMetricType

EventMetricType

data class EventMetricType : CommonMetricData (source)

This implements the developer facing API for recording events.

Instances of this class type are automatically generated by the parsers at built time, allowing developers to record events that were previously registered in the metrics.yaml file.

The Events API only exposes the record method, which takes care of validating the input data and making sure that limits are enforced.

Constructors

<init>

EventMetricType(disabled: Boolean, category: String, lifetime: Lifetime, name: String, sendInPings: List<String>, objects: List<String>, allowedExtraKeys: List<String>? = null)

This implements the developer facing API for recording events.

Properties

allowedExtraKeys

val allowedExtraKeys: List<String>?

category

val category: String

defaultStorageDestinations

val defaultStorageDestinations: List<String>

Defines the names of the storages the metric defaults to when "default" is used as the destination storage. Note that every metric type will need to override this.

disabled

val disabled: Boolean

lifetime

val lifetime: Lifetime

name

val name: String

objects

val objects: List<String>

sendInPings

val sendInPings: List<String>

Functions

record

fun record(objectId: String, value: String? = null, extra: Map<String, String>? = null): Unit

Record an event by using the information provided by the instance of this class.

Inherited Functions

getStorageNames

open fun getStorageNames(): List<String>

Get the list of storage names the metric will record to. This automatically expands DEFAULT_STORAGE_NAME to the list of default storages for the metric.

shouldRecord

open fun shouldRecord(logger: Logger): Boolean