feat(rtcstats): switch to rtcstats v3 protocol (#8989)
* use new rtcstats clinet * add room name to identity * update rtcstats version
This commit is contained in:
parent
12552766ce
commit
96e886d306
|
@ -15059,10 +15059,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rtcstats": {
|
"rtcstats": {
|
||||||
"version": "github:jitsi/rtcstats#0597c6a928f321d3cdec947d877012b7e8c2f1dc",
|
"version": "github:jitsi/rtcstats#7593044b35b46881fb88af9b20db0f9b660f5752",
|
||||||
"from": "github:jitsi/rtcstats#v6.2.0",
|
"from": "github:jitsi/rtcstats#v8.0.1",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@jitsi/js-utils": "1.0.0"
|
"@jitsi/js-utils": "1.0.0",
|
||||||
|
"uuid": "3.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jitsi/js-utils": {
|
"@jitsi/js-utils": {
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
"redux": "4.0.4",
|
"redux": "4.0.4",
|
||||||
"redux-thunk": "2.2.0",
|
"redux-thunk": "2.2.0",
|
||||||
"rnnoise-wasm": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
|
"rnnoise-wasm": "github:jitsi/rnnoise-wasm#566a16885897704d6e6d67a1d5ac5d39781db2af",
|
||||||
"rtcstats": "github:jitsi/rtcstats#v6.2.0",
|
"rtcstats": "github:jitsi/rtcstats#v8.0.1",
|
||||||
"styled-components": "3.4.9",
|
"styled-components": "3.4.9",
|
||||||
"util": "0.12.1",
|
"util": "0.12.1",
|
||||||
"uuid": "3.1.0",
|
"uuid": "3.1.0",
|
||||||
|
|
|
@ -37,14 +37,30 @@ class RTCStats {
|
||||||
* loaded before it does.
|
* loaded before it does.
|
||||||
*
|
*
|
||||||
* @param {Object} options -.
|
* @param {Object} options -.
|
||||||
* @param {string} options.rtcstatsEndpoint - The Amplitude app key required.
|
* @param {string} options.endpoint - The Amplitude app key required.
|
||||||
* @param {number} options.rtcstatsPollInterval - The getstats poll interval in ms.
|
* @param {string} options.useLegacy - Switch to legacy chrome webrtc statistics. Parameter will only have
|
||||||
|
* an effect on chrome based applications.
|
||||||
|
* @param {number} options.pollInterval - The getstats poll interval in ms.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
init(options) {
|
init(options) {
|
||||||
this.handleTraceWSClose = this.handleTraceWSClose.bind(this);
|
|
||||||
this.trace = traceInit(options.rtcstatsEndpoint, this.handleTraceWSClose);
|
const { endpoint, useLegacy, pollInterval } = options;
|
||||||
rtcstatsInit(this.trace, options.rtcstatsPollInterval, [ '' ], connectionFilter);
|
|
||||||
|
const traceOptions = {
|
||||||
|
endpoint,
|
||||||
|
onCloseCallback: this.handleTraceWSClose.bind(this),
|
||||||
|
useLegacy
|
||||||
|
};
|
||||||
|
|
||||||
|
const rtcstatsOptions = {
|
||||||
|
connectionFilter,
|
||||||
|
pollInterval,
|
||||||
|
useLegacy
|
||||||
|
};
|
||||||
|
|
||||||
|
this.trace = traceInit(traceOptions);
|
||||||
|
rtcstatsInit(this.trace, rtcstatsOptions);
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +82,7 @@ class RTCStats {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
sendIdentityData(identityData) {
|
sendIdentityData(identityData) {
|
||||||
this.trace && this.trace('identity', null, identityData);
|
this.trace && this.trace.identity('identity', null, identityData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getAmplitudeIdentity } from '../analytics';
|
import { getAmplitudeIdentity } from '../analytics';
|
||||||
import { CONFERENCE_UNIQUE_ID_SET } from '../base/conference';
|
import { CONFERENCE_UNIQUE_ID_SET, getRoomName } from '../base/conference';
|
||||||
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
|
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
|
||||||
import { getLocalParticipant } from '../base/participants';
|
import { getLocalParticipant } from '../base/participants';
|
||||||
import { MiddlewareRegistry } from '../base/redux';
|
import { MiddlewareRegistry } from '../base/redux';
|
||||||
|
@ -22,6 +22,7 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
const config = state['features/base/config'];
|
const config = state['features/base/config'];
|
||||||
const { analytics } = config;
|
const { analytics } = config;
|
||||||
|
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case LIB_WILL_INIT: {
|
case LIB_WILL_INIT: {
|
||||||
if (isRtcstatsEnabled(state)) {
|
if (isRtcstatsEnabled(state)) {
|
||||||
|
@ -30,14 +31,17 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
// init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the
|
// init, we need to add these proxies before it initializes, otherwise lib-jitsi-meet will use the
|
||||||
// original non proxy versions of these functions.
|
// original non proxy versions of these functions.
|
||||||
try {
|
try {
|
||||||
// Default poll interval is 1000ms if not provided in the config.
|
// Default poll interval is 1000ms and standard stats will be used, if not provided in the config.
|
||||||
const pollInterval = analytics.rtcstatsPollInterval || 1000;
|
const pollInterval = analytics.rtcstatsPollInterval || 1000;
|
||||||
|
const useLegacy = analytics.rtcstatsUseLegacy || false;
|
||||||
|
|
||||||
|
|
||||||
// Initialize but don't connect to the rtcstats server wss, as it will start sending data for all
|
// Initialize but don't connect to the rtcstats server wss, as it will start sending data for all
|
||||||
// media calls made even before the conference started.
|
// media calls made even before the conference started.
|
||||||
RTCStats.init({
|
RTCStats.init({
|
||||||
rtcstatsEndpoint: analytics.rtcstatsEndpoint,
|
endpoint: analytics.rtcstatsEndpoint,
|
||||||
rtcstatsPollInterval: pollInterval
|
useLegacy,
|
||||||
|
pollInterval
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Failed to initialize RTCStats: ', error);
|
logger.error('Failed to initialize RTCStats: ', error);
|
||||||
|
@ -68,6 +72,7 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
RTCStats.sendIdentityData({
|
RTCStats.sendIdentityData({
|
||||||
...getAmplitudeIdentity(),
|
...getAmplitudeIdentity(),
|
||||||
...config,
|
...config,
|
||||||
|
confName: getRoomName(state),
|
||||||
displayName: localParticipant?.name,
|
displayName: localParticipant?.name,
|
||||||
meetingUniqueId
|
meetingUniqueId
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue