Simple Counter With Threshold

Here is an example of a simple counter to have the average of orders processing time in the application.

[ \example\Orders_processing_time : kpsastats::CounterConf ] 
name = Orders_processing_time 
description = Orders processing time statistics 
startOnCreate = yes 
periodManager = MyPeriodManager 
dataSaver = MyDataSaver 
memorizedPeriod = 1 
dynamic = no 

# The order processing time in microseconds is on parameter #2 of event 
# MyOrderDic:OrderProcessed
# 
[ \example\Opt_sum : kpsastats::BRawSumParamConf ] 
name = Opt_sum 
counterName = Orders_processing_time 
description = Sum of orders processing times. 
dictionary = MyOrderDic 
eventId = OrderProcessed 
paramIndex = 2 

[ \example\Opt_nb : kpsastats::CRawValidNumberConf ] 
name = Opt_nb 
counterName = Orders_processing_time 
description = Number of orders processing times. 
rawName = Opt_sum 

[ \example\Opt_min : kpsastats::CRawEventMinConf ] 
name = Opt_min 
counterName = Orders_processing_time 
description = Minimum of orders processing times. 
rawName = Opt_sum 

[ \example\Opt_max : kpsastats::CRawEventMaxConf ] 
name = Opt_max 
counterName = Orders_processing_time 
description = Maximum of orders processing times. 
rawName = Opt_sum 

# The average is calculated once per period, not in real time. 
# 
[ \example\Opt_average : kpsastats::CSampledRateConf ] 
name = Opt_average 
counterName = Orders_processing_time 
description = Average of orders processing times (= Opt_sum / Opt_nb). 
data1 = Opt_sum 
data2 = Opt_nb
Note:

Definitions of counterDatas must be set in the same statistic configutation file than their counter.

A threshold is defined to know when the average processing time goes over 1 second.

[ \example\Opt_AverageTooHigh : kpsastats::ThresholdConf ] 
name = Opt_AverageTooHigh 
appliesTo = Opt_average 
counterName = Orders_processing_time 
description = Threshold on average processing time (in microseconds). 
waterMarkType = high 
waterMarkValue = 1000000
Warning:

To make this example working, virtual event MyOrderDic:OrderProcessed must be replaced by an existing one.