瀏覽代碼

feat(JSPC): ICE establishment time (#488)

* feat(JSPC): ICE establishment time

Will report total ICE establishment time under
'ice.initiator.establishmentDuration' and
'ice.responder.establishmentDuration' ('p2p.' prefix added for P2P).
It's the amount of time between the time when either checking or
gathering started (whichever starts first) and when ICE entered
'connected' for the first time.

* fix(JSPC): simplify and rename event
master
Paweł Domas 8 年之前
父節點
當前提交
2459de07c8
共有 1 個檔案被更改,包括 15 行新增2 行删除
  1. 15
    2
      modules/xmpp/JingleSessionPC.js

+ 15
- 2
modules/xmpp/JingleSessionPC.js 查看文件

@@ -351,12 +351,25 @@ export default class JingleSessionPC extends JingleSession {
351 351
                     let eventName = this.isP2P ? 'p2p.ice.' : 'ice.';
352 352
 
353 353
                     eventName += this.isInitiator ? 'initiator.' : 'responder.';
354
-                    eventName += 'checksDuration';
355 354
                     Statistics.analytics.sendEvent(
356
-                        eventName,
355
+                        `${eventName}checksDuration`,
357 356
                         {
358 357
                             value: now - this._iceCheckingStartedTimestamp
359 358
                         });
359
+
360
+                    // Switch between ICE gathering and ICE checking whichever
361
+                    // started first (scenarios are different for initiator
362
+                    // vs responder)
363
+                    const iceStarted
364
+                        = Math.min(
365
+                            this._iceCheckingStartedTimestamp,
366
+                            this._gatheringStartedTimestamp);
367
+
368
+                    Statistics.analytics.sendEvent(
369
+                        `${eventName}establishmentDuration`,
370
+                        {
371
+                            value: now - iceStarted
372
+                        });
360 373
                     this.wasConnected = true;
361 374
                     this.room.eventEmitter.emit(
362 375
                             XMPPEvents.CONNECTION_ESTABLISHED, this);

Loading…
取消
儲存