Stats - Get Total Time by Reason Code

Hello All,
How can i get the total time spent by certain user in an specific Not Ready Reason code?

Any clue?

Thanks!

Hi,

You have to define a filter and apply it to TotalTime in NotReady status statistic.

R.

Thanks Rene!

How do i define the filter ? Right now what i have is


             req.StatisticObject = StatisticObject.Create();
             req.StatisticObject.ObjectType = StatisticObjectType.Agent;
             req.StatisticObject.TenantName = "Resources";
             req.StatisticObject.ObjectId = "UserID";
            

             req.StatisticMetric = StatisticMetric.Create();
             req.StatisticMetric.StatisticType = "TotalNotReadyStatusTime";
             

             req.ReferenceId = 2;

             protocolManagment[statServerConfigName].Send(req);

Thanks!

Remember you have:

Metric applied to an object = Statistic

So on StatisticMetric you define filter too as you would do on CCPulse for example and there you go :wink:
You can find more info on the PSDK doc that inside the Doc folder on the install path

Thanks cavagnaro !

i have created a Filter in the stat Server as

Name = LunchTime
Value= ExtensionReasonCode=“Lunch”

Then i did the call

'RequestGetStatistic' ('1033')
message attributes:
StatisticObject = ComplexClass(StatisticObject):
	TENANT_PASSWORD [str] = [output suppressed]
	OBJECT [int]    = 0 [Agent]
	TENANT_ID [str] = "Resources"
	OBJECT_ID [str] = "891536"
StatisticMetric = ComplexClass(StatisticMetric):
	STATTYPE [str]  = "TotalNotReadyStatusTime"
	ACTION_FILTER [str] = "LunchTime"
REQ_ID [int]    = 2
VOID_VALUE [bstr] = KVList: 
		'Filter' [str] = "LunchTime"

'EventInfo' ('2')
message attributes:
REQ_ID [int]    = 2
USER_REQ_ID [int] = -1
TM_SERVER [int] = 1373470691
TM_LENGTH [int] = 190
LONG_VALUE [int] = 0
STRING_VALUE [str] = "0"


But i think that the Value is not correct despite i dont receive an error response.

Does it work on CCPulse?
Try that first. When you have values on CCPulse you can go to your development

Yes, i am trying that also but i always get 0 (Despite of the fact that i know that the user has been at Lunch as NotReady Reason Code)

This means that i defined the Filter in a wrong way, or something else it is going on…

I will keep trying, Thanks for all your help !!

Check TServer logs, compare the KVPs

I checked that also. I also checked Stat Server Documentation and it says..

• ExtensionReasonCode != 12 (or Reason != 12) returns True if the Extension TEvent returns a key-value pair of ReasonCode (the key) and its accompanying value which is equal to a value other than 12. From 8.0 release, Stat Server supports less than or equal, greater than or equal, greater than, less than expressions for numeric operands. For example:

So I set up the Filter as

Option Name : LunchTime
Option Value : Reason = 4

From my app when i change to lunch i receive;

2013-07-10 15:57:19,511 MOSAIC DEBUG [THREAD : SelectorThread] - Proxy got message 'EventAgentNotReady' ('76')
message attributes:
AttributeThisDN [str] = "7016"
AttributeReasons [bstr] = KVList: 
		'Lunch' [int] = 4
CallHistory     = ComplexClass(CallHistoryInfo):
	LastParty       = ComplexClass(LastRemoteParty):
	FirstParty      = ComplexClass(FirstRemoteParty):
AttributeExtensions [bstr] = KVList: 
		'AgentSessionID' [str] = "EOI98SBB6T77N1ECVMFKESAVG4011VQG"
AttributeEventSequenceNumber [long] = 4732958
AttributeAgentID [str] = "fromero"
AttributeReferenceID [int] = 4
Time            = ComplexClass(TimeStamp):
	AttributeTimeinuSecs [int] = 817000
	AttributeTimeinSecs [int] = 1373482639
AttributeAgentWorkMode [int] = 4 [AuxWork]

Meanwhile, at TServer, I can see

15:57:19.817 Trc 04541 RequestAgentNotReady received from [660] (0000020d MosaicDesktop 10.135.103.118:58848)
message RequestAgentNotReady
	AttributeReason	[16] 00 01 01 00..
		'Lunch'	4
	AttributeReferenceID	4
	AttributeAgentWorkMode	4 (AuxWork)
	AttributeThisDN	'7016'
@15:57:19.8170 [gctmi] Distributing request RequestAgentNotReady
@15:57:19.8170 [tsgctm] AgentLogin [7016,idfromero,sNRDY] softAgent: sending not-ready.
@15:57:19.8170 [gctmi] AgentLogin [7016,idfromero,sNRDY] distributing EventAgentNotReady
@15:57:19.8170 [gctmi] AgentLogin [7016,idfromero,sNRDY] processNotReady
@15:57:19.8170 [gctmi] request RequestAgentNotReady ctiRefId 324832 removed from reqMgr
@15:57:19.8170 [0] 8.1.001.06 distribute_response: message EventAgentNotReady
	AttributeExtensions	[53] 00 01 00 00..
		'AgentSessionID'	'EOI98SBB6T77N1ECVMFKESAVG4011VQG'
	AttributeEventSequenceNumber	000000000048381e
	AttributeTimeinuSecs	817000
	AttributeTimeinSecs	1373482639 (15:57:19)
	AttributeThisDN	'7016'
	AttributeAgentWorkMode	4 (AuxWork)
	AttributeAgentID	'fromero'
	AttributeReason	[16] 00 01 01 00..
		'Lunch'	4
	AttributeReferenceID	4

but later when i call the stats, with the filter, i receive 0

'RequestGetStatistic' ('1033')
message attributes:
StatisticObject = ComplexClass(StatisticObject):
	TENANT_PASSWORD [str] = [output suppressed]
	OBJECT [int]    = 0 [Agent]
	TENANT_ID [str] = "Resources"
	OBJECT_ID [str] = "891536"
StatisticMetric = ComplexClass(StatisticMetric):
	STATTYPE [str]  = "TotalNotReadyStatusTime"
	ACTION_FILTER [str] = "LunchTime"
REQ_ID [int]    = 2
VOID_VALUE [bstr] = KVList: 
		'Filter' [str] = "LunchTime"

'EventInfo' ('2')
message attributes:
REQ_ID [int]    = 2
USER_REQ_ID [int] = -1
TM_SERVER [int] = 1373482781
TM_LENGTH [int] = 4387
LONG_VALUE [int] = 0
STRING_VALUE [str] = "0"

I am quite lost (and new with Stat Server)

Thanks for all your help on this!

Your KVP is LUNCH = 4
So your filter should be

PairExists(“LUNCH”,“4”)

Excellent!!! IT works!!!

Thanks forma all your help!!