Browse Source

feat(rtcstats): switch to rtcstats v3 protocol (#8989)

* use new rtcstats clinet

* add room name to identity

* update rtcstats version
factor2
Andrei Gavrilescu 4 years ago
parent
commit
96e886d306
No account linked to committer's email address
4 changed files with 36 additions and 14 deletions
  1. 4
    3
      package-lock.json
  2. 1
    1
      package.json
  3. 22
    6
      react/features/rtcstats/RTCStats.js
  4. 9
    4
      react/features/rtcstats/middleware.js

+ 4
- 3
package-lock.json View File

15059
       }
15059
       }
15060
     },
15060
     },
15061
     "rtcstats": {
15061
     "rtcstats": {
15062
-      "version": "github:jitsi/rtcstats#0597c6a928f321d3cdec947d877012b7e8c2f1dc",
15063
-      "from": "github:jitsi/rtcstats#v6.2.0",
15062
+      "version": "github:jitsi/rtcstats#7593044b35b46881fb88af9b20db0f9b660f5752",
15063
+      "from": "github:jitsi/rtcstats#v8.0.1",
15064
       "requires": {
15064
       "requires": {
15065
-        "@jitsi/js-utils": "1.0.0"
15065
+        "@jitsi/js-utils": "1.0.0",
15066
+        "uuid": "3.1.0"
15066
       },
15067
       },
15067
       "dependencies": {
15068
       "dependencies": {
15068
         "@jitsi/js-utils": {
15069
         "@jitsi/js-utils": {

+ 1
- 1
package.json View File

92
     "redux": "4.0.4",
92
     "redux": "4.0.4",
93
     "redux-thunk": "2.2.0",
93
     "redux-thunk": "2.2.0",
94
     "rnnoise-wasm": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
94
     "rnnoise-wasm": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
95
-    "rtcstats": "github:jitsi/rtcstats#v6.2.0",
95
+    "rtcstats": "github:jitsi/rtcstats#v8.0.1",
96
     "styled-components": "3.4.9",
96
     "styled-components": "3.4.9",
97
     "util": "0.12.1",
97
     "util": "0.12.1",
98
     "uuid": "3.1.0",
98
     "uuid": "3.1.0",

+ 22
- 6
react/features/rtcstats/RTCStats.js View File

37
      * loaded before it does.
37
      * loaded before it does.
38
      *
38
      *
39
      * @param {Object} options -.
39
      * @param {Object} options -.
40
-     * @param {string} options.rtcstatsEndpoint - The Amplitude app key required.
41
-     * @param {number} options.rtcstatsPollInterval - The getstats poll interval in ms.
40
+     * @param {string} options.endpoint - The Amplitude app key required.
41
+     * @param {string} options.useLegacy - Switch to legacy chrome webrtc statistics. Parameter will only have
42
+     * an effect on chrome based applications.
43
+     * @param {number} options.pollInterval - The getstats poll interval in ms.
42
      * @returns {void}
44
      * @returns {void}
43
      */
45
      */
44
     init(options) {
46
     init(options) {
45
-        this.handleTraceWSClose = this.handleTraceWSClose.bind(this);
46
-        this.trace = traceInit(options.rtcstatsEndpoint, this.handleTraceWSClose);
47
-        rtcstatsInit(this.trace, options.rtcstatsPollInterval, [ '' ], connectionFilter);
47
+
48
+        const { endpoint, useLegacy, pollInterval } = options;
49
+
50
+        const traceOptions = {
51
+            endpoint,
52
+            onCloseCallback: this.handleTraceWSClose.bind(this),
53
+            useLegacy
54
+        };
55
+
56
+        const rtcstatsOptions = {
57
+            connectionFilter,
58
+            pollInterval,
59
+            useLegacy
60
+        };
61
+
62
+        this.trace = traceInit(traceOptions);
63
+        rtcstatsInit(this.trace, rtcstatsOptions);
48
         this.initialized = true;
64
         this.initialized = true;
49
     }
65
     }
50
 
66
 
66
      * @returns {void}
82
      * @returns {void}
67
      */
83
      */
68
     sendIdentityData(identityData) {
84
     sendIdentityData(identityData) {
69
-        this.trace && this.trace('identity', null, identityData);
85
+        this.trace && this.trace.identity('identity', null, identityData);
70
     }
86
     }
71
 
87
 
72
     /**
88
     /**

+ 9
- 4
react/features/rtcstats/middleware.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { getAmplitudeIdentity } from '../analytics';
3
 import { getAmplitudeIdentity } from '../analytics';
4
-import { CONFERENCE_UNIQUE_ID_SET } from '../base/conference';
4
+import { CONFERENCE_UNIQUE_ID_SET, getRoomName } from '../base/conference';
5
 import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
5
 import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
6
 import { getLocalParticipant } from '../base/participants';
6
 import { getLocalParticipant } from '../base/participants';
7
 import { MiddlewareRegistry } from '../base/redux';
7
 import { MiddlewareRegistry } from '../base/redux';
22
     const config = state['features/base/config'];
22
     const config = state['features/base/config'];
23
     const { analytics } = config;
23
     const { analytics } = config;
24
 
24
 
25
+
25
     switch (action.type) {
26
     switch (action.type) {
26
     case LIB_WILL_INIT: {
27
     case LIB_WILL_INIT: {
27
         if (isRtcstatsEnabled(state)) {
28
         if (isRtcstatsEnabled(state)) {
30
             // init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the
31
             // init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the
31
             // original non proxy versions of these functions.
32
             // original non proxy versions of these functions.
32
             try {
33
             try {
33
-                // Default poll interval is 1000ms if not provided in the config.
34
+                // Default poll interval is 1000ms and standard stats will be used, if not provided in the config.
34
                 const pollInterval = analytics.rtcstatsPollInterval || 1000;
35
                 const pollInterval = analytics.rtcstatsPollInterval || 1000;
36
+                const useLegacy = analytics.rtcstatsUseLegacy || false;
37
+
35
 
38
 
36
                 // Initialize but don't connect to the rtcstats server wss, as it will start sending data for all
39
                 // Initialize but don't connect to the rtcstats server wss, as it will start sending data for all
37
                 // media calls made even before the conference started.
40
                 // media calls made even before the conference started.
38
                 RTCStats.init({
41
                 RTCStats.init({
39
-                    rtcstatsEndpoint: analytics.rtcstatsEndpoint,
40
-                    rtcstatsPollInterval: pollInterval
42
+                    endpoint: analytics.rtcstatsEndpoint,
43
+                    useLegacy,
44
+                    pollInterval
41
                 });
45
                 });
42
             } catch (error) {
46
             } catch (error) {
43
                 logger.error('Failed to initialize RTCStats: ', error);
47
                 logger.error('Failed to initialize RTCStats: ', error);
68
                 RTCStats.sendIdentityData({
72
                 RTCStats.sendIdentityData({
69
                     ...getAmplitudeIdentity(),
73
                     ...getAmplitudeIdentity(),
70
                     ...config,
74
                     ...config,
75
+                    confName: getRoomName(state),
71
                     displayName: localParticipant?.name,
76
                     displayName: localParticipant?.name,
72
                     meetingUniqueId
77
                     meetingUniqueId
73
                 });
78
                 });

Loading…
Cancel
Save