Expand all

mw.eventLog.Schema

The class allows inheriting classes to log events based on a sampling rate if sampling is enabled.

If the schema uses different sampling rates for different events, samplingRate can also be passed to individual events.

Example

var mySchema = new mw.eventLog.Schema( 'Name', 0.01, { skin: 'minerva' } );
// Log the following event at the default sampling rate of 0.01.
mySchema.log( { action: 'viewed' } );
// Log the following event at the sampling rate of 0.2.
mySchema.log( { action: 'clicked' }, 0.2 );

Constructor

new mw.eventLog.Schema(name, [samplingRate], [defaults]) #

Parameters:

Name Type Attributes Default Description
name string

Schema name to log to.

samplingRate number optional
1

The rate at which sampling is performed. The values are between 0 and 1 inclusive.

defaults Object optional

A set of defaults to log to the schema. Once these defaults are set the values will be logged along with any additional fields that are passed to the log method.

Source:

Methods

log(data, [samplingRate]) #

Log an event via the EventLogging subscriber.

Parameters:

Name Type Attributes Description
data Object

Data to log

samplingRate number optional

Number between 0 and 1. Defaults to this.samplingRate.

Source:
Log an event via the EventLogging subscriber.