feat(rtcstats): fetch conference creator id and send to rtcstats (#14060)

* fetch conference creator id and send to rtcstats

* fix lint

* fix lint again
pull/14095/head jitsi-meet_9122
Andrei Gavrilescu 2 years ago committed by GitHub
parent 71658a5de6
commit 3a1fc363ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      react/features/base/config/configType.ts
  2. 26
      react/features/jaas/functions.ts
  3. 10
      react/features/rtcstats/RTCStats.ts
  4. 12
      react/features/rtcstats/middleware.ts

@ -460,6 +460,7 @@ export interface IConfig {
inviteServiceCallFlowsUrl?: string;
inviteServiceUrl?: string;
jaasActuatorUrl?: string;
jaasConferenceCreatorUrl?: string;
jaasFeedbackMetadataURL?: string;
jaasTokenUrl?: string;
legalUrls?: {

@ -1,4 +1,5 @@
import { IReduxState } from '../app/types';
import { IJitsiConference } from '../base/conference/reducer';
import { VPAAS_TENANT_PREFIX } from './constants';
import logger from './logger';
@ -47,6 +48,31 @@ export function isVpaasMeeting(state: IReduxState) {
return false;
}
/**
* Sends a request for retrieving the conference creator's customer id.
*
* @param {IJitsiConference} conference - The conference state.
* @param {IReduxState} state - The state of the app.
* @returns {Object} - Object containing customerId field.
*/
export async function sendGetCustomerIdRequest(conference: IJitsiConference, state: IReduxState) {
const { jaasConferenceCreatorUrl } = state['features/base/config'];
const roomJid = conference?.room?.roomjid;
if (jaasConferenceCreatorUrl && roomJid) {
const fullUrl = `${jaasConferenceCreatorUrl}?conference=${encodeURIComponent(roomJid)}`;
const response = await fetch(fullUrl);
const responseBody = await response.json();
if (response.ok) {
return responseBody;
}
logger.error(`Failed to fetch ${fullUrl}. with: ${JSON.stringify(responseBody)}`);
}
}
/**
* Sends a request for retrieving jaas customer details.
*

@ -69,6 +69,16 @@ class RTCStats {
JitsiMeetJS.rtcstats.sendStatsEntry('e2eRtt', e2eRttData);
}
/**
* Send identity data, the data will be processed by rtcstats-server and saved in the dump file.
*
* @param {Object} identityData - The object that holds the identity data.
* @returns {void}
*/
sendIdentityData(identityData: Object) {
JitsiMeetJS.rtcstats.sendIdentityEntry(identityData);
}
/**
* Send the timestamp of the start of the conference, the data will be processed by the rtcstats-server
* and saved in the dump file.

@ -11,12 +11,14 @@ import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { TRACK_ADDED, TRACK_UPDATED } from '../base/tracks/actionTypes';
import { ADD_FACE_LANDMARKS } from '../face-landmarks/actionTypes';
import { FaceLandmarks } from '../face-landmarks/types';
import { sendGetCustomerIdRequest } from '../jaas/functions';
import RTCStats from './RTCStats';
import {
canSendFaceLandmarksRTCStatsData,
isRTCStatsEnabled
} from './functions';
import logger from './logger';
/**
* Middleware which intercepts lib-jitsi-meet initialization and conference join in order init the
@ -33,6 +35,16 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: AnyA
case CONFERENCE_JOINED: {
if (isRTCStatsEnabled(state)) {
RTCStats.init();
sendGetCustomerIdRequest(action?.conference, state)
.then(customerData => {
const { customerId } = customerData ?? {};
customerId && RTCStats.sendIdentityData({ customerId });
})
.catch(error => {
logger.error('Error while getting customer id:', error);
});
}
break;
}

Loading…
Cancel
Save