Преглед изворни кода

feat(AvgRTPStatsReporter): add samples

Will also log samples next to the average value for debugging purposes.
dev1
paweldomas пре 8 година
родитељ
комит
e12b0e60f8
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7
    1
      modules/statistics/AvgRTPStatsReporter.js

+ 7
- 1
modules/statistics/AvgRTPStatsReporter.js Прегледај датотеку

25
         this.name = name;
25
         this.name = name;
26
         this.count = 0;
26
         this.count = 0;
27
         this.sum = 0;
27
         this.sum = 0;
28
+        this.samples = [];
28
     }
29
     }
29
 
30
 
30
     /**
31
     /**
39
                 nextValue);
40
                 nextValue);
40
         } else if (!isNaN(nextValue)) {
41
         } else if (!isNaN(nextValue)) {
41
             this.sum += nextValue;
42
             this.sum += nextValue;
43
+            this.samples.push(nextValue);
42
             this.count += 1;
44
             this.count += 1;
43
         }
45
         }
44
     }
46
     }
62
     report(isP2P) {
64
     report(isP2P) {
63
         Statistics.analytics.sendEvent(
65
         Statistics.analytics.sendEvent(
64
             `${isP2P ? 'p2p.' : ''}${this.name}`,
66
             `${isP2P ? 'p2p.' : ''}${this.name}`,
65
-            { value: this.calculate() });
67
+            {
68
+                value: this.calculate(),
69
+                samples: this.samples
70
+            });
66
     }
71
     }
67
 
72
 
68
     /**
73
     /**
70
      * calculated using this instance.
75
      * calculated using this instance.
71
      */
76
      */
72
     reset() {
77
     reset() {
78
+        this.samples = [];
73
         this.sum = 0;
79
         this.sum = 0;
74
         this.count = 0;
80
         this.count = 0;
75
     }
81
     }

Loading…
Откажи
Сачувај