1 |
|
2 |
|
3 |
|
4 |
|
5 | var agentSetting = require('./agent-setting');
|
6 |
|
7 | function categoryHandler(){}
|
8 |
|
9 | categoryHandler.getCategory = function(statusCode,respTime,threshold, dynamicSlowThresold, dynamicVerySlowThresold){
|
10 | if(dynamicSlowThresold > 0 && agentSetting.dynamicThreshold == 1){
|
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 |
|
34 | module.exports = categoryHandler;
|