Record Methods
Introduction
The record methods are used to access the statistics and Event Data Record features
of the n2svcd
framework.
These methods are accessed via the “n2.n2svcd” module:
local n2svcd = require "n2.n2svcd"
.stat_increment [Synchronous]
The stat_increment
method increments a statistics counter within the LogicApp.
The current statistics counter values can be viewed via the HTTP management console.
The statistics counters will be relayed to a StatsD collection agent if this is
configured in the n2svcd.xml
configuration file.
Parameter | Type | Description |
---|---|---|
name
|
String | The name of the StatsD statistic to increment. |
Example:
n2svcd.stat_increment ("feedback.success")
The stat_increment
method returns true
.
.write_edr [Synchronous]
The write_edr
method requests generation of an EDR of the indicated type, and with
the indicated EDR attribute values.
EDR records will be sent to the EDR Application by the LogicApp.
This requires that the executing LogicApp have EDRs enabled using the edr_enabled
flag in
the n2svcd.xml
configuration file.
This requires that an EDR Application be running, and the the executing LogicApp be configured to send to the EDR app.
This requires that the EDR stream key be configured in the EDR application. By default, the LogicApp’s stream key will be used. However, the calling LUA logic may specify an alternate stream key.
Parameter | Type | Description |
---|---|---|
event_name
|
String |
The name of the event type to log. This is recorded in the Event Type field within the EDR output file. |
fields
|
Table |
A Lua Table of additional fields to log for this event. Each element of the fields Table must have a value which is Scalar or List of Scalar.
|
stream_key
|
Table |
An optional stream key, if this EDR is to be written to a non-default EDR stream. This stream key must refer to a known, pre-configured stream key in the EdrApp .(Default = The default configured for the LogicApp )
|
Example:
n2svcd.write_edr ("FEEDBACK", { MSISDN = input.msisdn, SUCCESS = 1, MYLIST = { "First", "Second" } })
The write_edr
method returns true
.