ソースを参照

feat(AvgRTPStatsReporter): add samples

Will also log samples next to the average value for debugging purposes.
tags/v0.0.2
paweldomas 8年前
コミット
e12b0e60f8
1個のファイルの変更7行の追加1行の削除
  1. 7
    1
      modules/statistics/AvgRTPStatsReporter.js

+ 7
- 1
modules/statistics/AvgRTPStatsReporter.js ファイルの表示

@@ -25,6 +25,7 @@ class AverageStatReport {
25 25
         this.name = name;
26 26
         this.count = 0;
27 27
         this.sum = 0;
28
+        this.samples = [];
28 29
     }
29 30
 
30 31
     /**
@@ -39,6 +40,7 @@ class AverageStatReport {
39 40
                 nextValue);
40 41
         } else if (!isNaN(nextValue)) {
41 42
             this.sum += nextValue;
43
+            this.samples.push(nextValue);
42 44
             this.count += 1;
43 45
         }
44 46
     }
@@ -62,7 +64,10 @@ class AverageStatReport {
62 64
     report(isP2P) {
63 65
         Statistics.analytics.sendEvent(
64 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,6 +75,7 @@ class AverageStatReport {
70 75
      * calculated using this instance.
71 76
      */
72 77
     reset() {
78
+        this.samples = [];
73 79
         this.sum = 0;
74 80
         this.count = 0;
75 81
     }

読み込み中…
キャンセル
保存