UNPKG

1.12 kBJavaScriptView Raw
1/**
2 * Created by Siddhant on 17-08-2015.
3 */
4
5var agentSetting = require('./agent-setting');
6
7function categoryHandler(){}
8
9categoryHandler.getCategory = function(statusCode,respTime,threshold, dynamicSlowThresold, dynamicVerySlowThresold){
10 if(dynamicSlowThresold > 0 && agentSetting.dynamicThreshold == 1){ //Checking for dynamic threshold case
11 if(statusCode>=400)
12 return 13;
13 else if (respTime < dynamicSlowThresold) {
14 return 10;
15 } else if (respTime > dynamicSlowThresold && respTime < dynamicVerySlowThresold) {
16 return 11;
17 } else if(respTime > threshold.verySlowThresholds) {
18 return 12;
19 }
20 }
21 else{
22 if(statusCode>=400)
23 return 13;
24 else if (respTime <= threshold.slowThresholds) {
25 return 10;
26 } else if (respTime > threshold.slowThresholds && respTime <= threshold.verySlowThresholds) {
27 return 11;
28 } else if(respTime > threshold.verySlowThresholds) {
29 return 12;
30 }
31 }
32}
33
34module.exports = categoryHandler;