Track Long Responses With Query String

triggers

#1

Here is an example trigger that shows the full query string and URI when the process time exceeds a threshold.

 /*
Tracks the full URI and Query string for long running responses.
*/

var threshold = 500; // Set your threshold here...it is in milliseconds.

if(event == "HTTP_REQUEST"){
  var query = HTTP.query;
    if(!query){
        return;
    }else{
        Flow.store.qs = HTTP.query;  
    }
} 
else if(event == "HTTP_RESPONSE"){
   var qs = Flow.store.qs;
   var tprocess = HTTP.tprocess;
  // If we've exceeded threshold, do interesting stuff. Else, exit (return).
  if(tprocess >= threshold && qs){
    var key = HTTP.uri +"?"+ Flow.store.qs;
      log("Server: " + Flow.server.ipaddr + ": " + key);
    Device.metricAddCount('long_qs', 1); // increment a count for a long query.
    Device.metricAddDetailCount('long_qs_det', key, 1); // add detail.
      Device.metricAddSampleset('long_qs', tprocess);
    Device.metricAddDetailSampleset('long_qs_det', key, tprocess); // 
  }
}

It creates a count so you can see how many times a particular URI / query string caused a long response, as well as a Sampleset for trending and per-request timing details.

Create a custom page and bind it to the devices you care about, and Bob’s your uncle! Post with any questions.