Measure target performance for calls to target from Javascript callout

I am making SOAP calls from Javascript and the target performance is not captured for those calls. Is there an approach that I can follow to measure the target service performance when calls to target are made from JAvascript.

Solved Solved
0 2 181
1 ACCEPTED SOLUTION

Maybe? It depends on what you mean by "measure".

One way to accomplish what you want may be:

  1. read the time-of-day before sending the request (var before = new Date(); )
  2. send the request
  3. await the response
  4. read the time-of-day again . (var after = new Date(); )
  5. subtract the two times, obtaining the elapsed time . (var elapsed =
  6. set a context variable to that value
  7. use StatisticsCollector to store that value to the analytics stream. This means you will be able to create AX reports on that data.

Does this sound like what you want?

the JS part looks like this:

var before = context.getVariable('system.timestamp');
// send request here, await response
var after = context.getVariable('system.timestamp');
var delta = Math.floor(end - start);
context.setVariable('time-total-elapsed', delta);

Reading 'system.timestamp' gives you a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC. I know this from having read the variables reference.

View solution in original post

2 REPLIES 2

Maybe? It depends on what you mean by "measure".

One way to accomplish what you want may be:

  1. read the time-of-day before sending the request (var before = new Date(); )
  2. send the request
  3. await the response
  4. read the time-of-day again . (var after = new Date(); )
  5. subtract the two times, obtaining the elapsed time . (var elapsed =
  6. set a context variable to that value
  7. use StatisticsCollector to store that value to the analytics stream. This means you will be able to create AX reports on that data.

Does this sound like what you want?

the JS part looks like this:

var before = context.getVariable('system.timestamp');
// send request here, await response
var after = context.getVariable('system.timestamp');
var delta = Math.floor(end - start);
context.setVariable('time-total-elapsed', delta);

Reading 'system.timestamp' gives you a 64-bit (long) integer containing the number of milliseconds elapsed since midnight, on January 1, 1970 UTC. I know this from having read the variables reference.

Thanks it helps. I was also planning for custom implementation by adding the time stamp before calling and after the call returns, just wanted to check if something apigee captures by default.