9.50.5 Latency Statistics Related APL Functions

If the time arguments (startTime, stopTime) are not specified, the current time according to the local JVM will be used.

LatencyStart

Starts a latency measurement and (unless it already exists) creates its associated histogram.

any latencyStart
( string key1, 
  string key2
  [,long startTime] //Optional
);

Parameter

ParameterDescription

key1

Primary measurement identifier. This denotes the end-points between which to measure the latency. It is an arbitrary string such as “CCR_CCA” (which could indicate that the latency between reception of a CCR and response of CCA is measured).

key2

Traffic case discriminator. Arbitrary string to further classify the histogram. Key2 combined with key1 identifies a unique set of buckets that can be added together to a latency histogram. This key could be constructed from usage data in the request for example source, event type, etc. A null value indicates no further classification.

startTime

The time when the latency should begin being measured. If the  startTime  parameter is not defined in another way, the APL function dateNanoseconds() will on entry, assign the startTime.

Returns

statID a unique identifier. It is used as argument in the latencyStop function.

Note if the Latency Statistics agent is not present in a workflow the function will always return null.

LatencyStop

The function stops a latency timer. When the latency value has been determined, it will increment the corresponding bucket in the appropriate latency histogram (identified by key1 and key2 of latencyStart).

long latencyStop
   ( any statID, 
     [long stopTime]  //Optional
    );

Parameters

ParameterDescription

statID

A unique identifier returned from the latencyStart function.

stopTime

The time when the latency measurement is ended.

Returns

  • >= 0: Recorded latency in nanoseconds.

  • -1: Id mismatch, the statID was not found. Either because the argument was not returned from latencyStart, or the timeout value of the Latency Collector was exceeded. This is measured from the point where latencyStart was called.

  • -2: Negative latency encountered. This happens if an explicit startTime used in the latencyStart causes negative latency or if a stopTime is stated.

  • -3: Latency not enabled.

LatencyAdd

The function is a latencyStart and latencyStop combined.

long latencyAdd
    ( string key1, 
      string key2,
      long startTime
      [, long stopTime] //Optional
    );

Parameters

ParameterDescription

key1

Primary measurement identifier.

key2

Traffic case discriminator.

startTime

The time when the latency should begin being measured.

Note that this parameter is not optional.

stopTime

The time when the latency measurement is ended.

Returns

  • >= 0: Recorded latency in nanoseconds.

  • -2: Negative latency encountered. This only happens if an explicit startTime used in the latencyAdd causes negative latency.

  • -3: Latency not enabled.

IsLatencyEnabled

boolean isLatencyEnabled; 

Parameters

ParameterDescription

Returns

True, if latency measurements are enabled.