Skip to content

SamplingEventTrigger

A trigger that triggers when a measurement of measureType is collected.

For example, if measureType is CamsDataTypes.COMPLETED_APP_TASK, the triggerCondition can be a CompletedAppTask with a specific CompletedTask.taskName, to trigger when that task is done. Unlike ConditionalSamplingEventTrigger, it can be serialized to JSON.

Inheritance
Annotations

Constructors

SamplingEventTrigger.fromJson

SamplingEventTrigger.fromJson(
  1. Map<String, dynamic> json
)

SamplingEventTrigger

SamplingEventTrigger({
  1. required String measureType,
  2. Data? triggerCondition,
})

Creates a trigger that triggers when a measure of measureType is collected, and checks the triggerCondition to determine if it should trigger.

Properties

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

measureType

String measureType
getter/setter pair

The data type of the event to look for.

If triggerCondition is null, sampling will be triggered for all events of this type.

triggerCondition

Data? triggerCondition
getter/setter pair

The specific sampling value to compare with for triggering this trigger.

When comparing, the Data.equivalentTo method is used. Hence, the sampled data must be "equivalent" to this triggerCondition in order to trigger based on an event. Note that the equivalentTo method must be overridden in application-specific Data classes to support this.

If triggerCondition is null, sampling will be triggered on every sampling event that matches the specified measureType.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.