Preprocessor

Preprocessor objects are responsible for normalizing and filtering HVEvent objects before they are processed by data collectors.

Properties

  • integer uploadTimeLimit: (Recommended) Maximum uploadTime value (ms) that is included in response time calculation.

  • FieldXform[] xforms: Transformers to be applied to the incoming fields. Transformations are performed in the provided order and are done after response time calculation.

    All fields are treated as strings for this function.

  • FieldFilter[] filters: Filters to describe any events that should be ignored. An event that matches any filter in the preprocessor is ignored.

Methods

  • String toString(): Returns a string description of the preprocessor.

  • Boolean isValid(): Returns True if all included xforms and filters are valid.

Description

Preprocessor objects are responsible for normalizing and filtering HVEvent objects before they are processed by data collectors. A deployed preprocessor is the first to handle event data coming in from the browser. First, it populates the response time field by adding the provided upload time and download time values. However, if the provided upload time is greater than the specified uploadTimeLimit, the upload time value is ignored and the response time will equal the download time.

After the deployed preprocessor populates the response time, it performs data transformations as specified by any included xforms. If multiple xforms are specified, they are applied in the sequence that they appear in the array. Following that, filters are applied. Any event matching a preprocessor filter is excluded from further processing.

Example

// filter out local subnet to prevent skew.
 var subnetFilter= metrics.createFieldFilter(  
     'ipFilter', 
     metrics.constants.FN_CLIENT_IP, 
     '192.168.1.*');
 var ieXform = metrics.createXform(
     'IE xform', 
     metrics.constants.FN_USER_AGENT, 
     '(.*)(MSIE[^;]*)(.*)', 
     '$2',
     'browserVersion',
     metrics.constants.CASE_TO_LOWER);
 var ffXform = metrics.createXform(
     'Firefox xform', 
     metrics.constants.FN_USER_AGENT, 
     '(.*)(Firefox\\S*)(.*)', 
     '$2',
     'browserVersion',
     metrics.constants.CASE_TO_LOWER);     
 var preproc = metrics.createPreprocessor();
 preproc.uploadTimeLimit=2000;
 preproc.xforms=[ieXform,ffXform];
 preproc.filters=[subnetFilter];