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,7 +233,14 @@ export default function JitsiConference(options) {
233 233
 
234 234
     this.videoSIPGWHandler = new VideoSIPGW(this.room);
235 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 246
 // FIXME convert JitsiConference to ES6 - ASAP !
@@ -542,6 +549,9 @@ JitsiConference.prototype.leave = function() {
542 549
     this.getLocalTracks().forEach(track => this.onLocalTrackRemoved(track));
543 550
 
544 551
     this.rtc.closeBridgeChannel();
552
+
553
+    this._sendConferenceLeftAnalyticsEvent();
554
+
545 555
     if (this.statistics) {
546 556
         this.statistics.dispose();
547 557
     }
@@ -3338,7 +3348,29 @@ JitsiConference.prototype._sendConferenceJoinAnalyticsEvent = function() {
3338 3348
         meetingId,
3339 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,8 +36,8 @@ export class PerformanceObserverStats {
36 36
      */
37 37
     getLongTasksStats() {
38 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