Meter Processor

Cloud_Edition_button.webp

In the meter processor function, you configure guiding rules for the usage that needs to be guided to meters belonging to different categories of meter types. See for more information about guiding rules, categories, meter types, and the relationships between them.

Input Data Records

The input data which is fed into the meter processor must contain a userId and value. The UserId is a unique customer identifier, such as an email address or phone number. The value field identifies the customer’s usage, for example, minutes surfed, items purchased, or movies downloaded. If the original records do not contain fields with these names, you can use the , , or functions to modify the records before the data is sent to the meter processor. The usage data may also have an optional field timestamp which is used to verify that usage has occurred when the meter was active. If the timestamp field is empty the record will use the meter’s current timestamp according to the timezone set.

Timestamp Format

The supported timestamp format is ISO 8601 (extended format) in accordance with the YYYY-MM-DDTHH:mm:ss.sssZ pattern or Unix timestamp format in milliseconds.

In case you need to convert a date format to support the ISO standard, see Script.

An example would be: "2019-01-13T00:00:00.000Z" for ISO 8601 or “1547337600000“ for Unix timestamp in milliseconds.

If the incoming usage data records are missing any required fields (i.e. userId or value) then data is sent to Data Correction. If the data has records with a timestamp before the Active from date time or after the Active to date time, or if the timestamp is in the future, then those records will be sent to Data Correction.

Data Correction can then be used to correct or adjust usage data fields and reprocess the data. See

Usage audits are generated when the input data is processed using Meter Processor or sent to Data Correction.

Meter Processor Configuration

The guiding rules determine which events should be counted for each meter. A meter processor function can have one or several guiding rules. If the usage data guiding rule finds the meter during the evaluation of the first rule, the following rules will not be checked. This means that the guiding rules need to be configured in order of execution priority. If the input record is not matched with any meter then the usage record is sent to data correction with a ‘no meter found’ error.
Apart from the meter type category each guiding rule can be determined by the following:

  • conditions - to match meters only when a certain condition is correct. If the condition you need to evaluate is complex then a map or script processor can be added before meter processor to simplify it.

  • group by (using field) - used to create itemization of the metered record based on a certain field for example, a streaming service downloaded a total of 15 units (10 units of movies and 5 units of shows).

  • Operations (using fields) - any field from the input data that you want to add to the metered record so that it can be sent downstream.

After the meter processor function is added to a stream it is assigned a meter key. The meter key is used when creating meters for the customers using the APIs. See

meter-processor-overview.png
Meter processor configuration overview

Once you have updated the configuration, you may test your metering solution by creating some test meters and sending mock input data.
Preview can be used to verify that the guiding rules are correctly configured and that meters are updated as expected. The whole metered record is visible in the function Preview which is updated with the correct values when you click the Preview button.

Subsections

This section has the following subsections: