determine duration of a request

Am new to APIGEE. Trying to build proxy and need to set the a fault when the duration of the request is greater than 100seconds.

How to estimate the time duration of a request.

0 2 126
2 REPLIES 2

I am assuming you want to calculate the time taken when a client hits/submits the request until it reaches the Apigee proxy.

It can be done using a simple JS policy,

var client_request_start_time = context.getVariable('client.received.start.timestamp');
var client_request_end_time  = context.getVariable('client.received.end.timestamp');
var time  = (client_request_end_time - client_request_start_time)/1000;
context.setVariable('log.time', time);

After JS, add a RaiseFault policy and set a,

<Condition>log.time > 100.0</Condition>

Thanks Siddharth. However, am looking for "maximum time to allow for the processing of any one request".