Selaa lähdekoodia

feat: send conference.left analytics event

...which contains conference duration in seconds and
performance stats (currently long tasks).
master
paweldomas 4 vuotta sitten
vanhempi
commit
d36d72db48
2 muutettua tiedostoa jossa 36 lisäystä ja 4 poistoa
  1. 34
    2
      JitsiConference.js
  2. 2
    2
      modules/statistics/PerformanceObserverStats.js

+ 34
- 2
JitsiConference.js Näytä tiedosto

233
 
233
 
234
     this.videoSIPGWHandler = new VideoSIPGW(this.room);
234
     this.videoSIPGWHandler = new VideoSIPGW(this.room);
235
     this.recordingManager = new RecordingManager(this.room);
235
     this.recordingManager = new RecordingManager(this.room);
236
-    this._conferenceJoinAnalyticsEventSent = false;
236
+
237
+    /**
238
+     * If the conference.joined event has been sent this will store the timestamp when it happened.
239
+     *
240
+     * @type {undefined|number}
241
+     * @private
242
+     */
243
+    this._conferenceJoinAnalyticsEventSent = undefined;
237
 }
244
 }
238
 
245
 
239
 // FIXME convert JitsiConference to ES6 - ASAP !
246
 // FIXME convert JitsiConference to ES6 - ASAP !
542
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
549
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
543
 
550
 
544
     this.rtc.closeBridgeChannel();
551
     this.rtc.closeBridgeChannel();
552
+
553
+    this._sendConferenceLeftAnalyticsEvent();
554
+
545
     if (this.statistics) {
555
     if (this.statistics) {
546
         this.statistics.dispose();
556
         this.statistics.dispose();
547
     }
557
     }
3338
         meetingId,
3348
         meetingId,
3339
         participantId: `${meetingId}.${this._statsCurrentId}`
3349
         participantId: `${meetingId}.${this._statsCurrentId}`
3340
     }));
3350
     }));
3341
-    this._conferenceJoinAnalyticsEventSent = true;
3351
+    this._conferenceJoinAnalyticsEventSent = Date.now();
3352
+};
3353
+
3354
+/**
3355
+ * Sends conference.left analytics event.
3356
+ * @private
3357
+ */
3358
+JitsiConference.prototype._sendConferenceLeftAnalyticsEvent = function() {
3359
+    const meetingId = this.getMeetingUniqueId();
3360
+
3361
+    if (!meetingId || !this._conferenceJoinAnalyticsEventSent) {
3362
+
3363
+        return;
3364
+    }
3365
+
3366
+    Statistics.sendAnalytics(createConferenceEvent('left', {
3367
+        meetingId,
3368
+        participantId: `${meetingId}.${this._statsCurrentId}`,
3369
+        stats: {
3370
+            duration: Math.floor((Date.now() - this._conferenceJoinAnalyticsEventSent) / 1000),
3371
+            perf: this.getPerformanceStats()
3372
+        }
3373
+    }));
3342
 };
3374
 };
3343
 
3375
 
3344
 /**
3376
 /**

+ 2
- 2
modules/statistics/PerformanceObserverStats.js Näytä tiedosto

36
      */
36
      */
37
     getLongTasksStats() {
37
     getLongTasksStats() {
38
         return {
38
         return {
39
-            average: (this.stats.getAverage() * SECONDS).toFixed(2), // calc rate per min
40
-            maxDuration: this.maxDuration
39
+            avgRatePerMinute: (this.stats.getAverage() * SECONDS).toFixed(2), // calc rate per min
40
+            maxDurationMs: this.maxDuration
41
         };
41
         };
42
     }
42
     }
43
 
43
 

Loading…
Peruuta
Tallenna