瀏覽代碼

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
                     let eventName = this.isP2P ? 'p2p.ice.' : 'ice.';
351
                     let eventName = this.isP2P ? 'p2p.ice.' : 'ice.';
352
 
352
 
353
                     eventName += this.isInitiator ? 'initiator.' : 'responder.';
353
                     eventName += this.isInitiator ? 'initiator.' : 'responder.';
354
-                    eventName += 'checksDuration';
355
                     Statistics.analytics.sendEvent(
354
                     Statistics.analytics.sendEvent(
356
-                        eventName,
355
+                        `${eventName}checksDuration`,
357
                         {
356
                         {
358
                             value: now - this._iceCheckingStartedTimestamp
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
                     this.wasConnected = true;
373
                     this.wasConnected = true;
361
                     this.room.eventEmitter.emit(
374
                     this.room.eventEmitter.emit(
362
                             XMPPEvents.CONNECTION_ESTABLISHED, this);
375
                             XMPPEvents.CONNECTION_ESTABLISHED, this);

Loading…
取消
儲存