Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove callstats support #2399

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 8 additions & 125 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,8 @@ JitsiConference.prototype._init = function(options = {}) {
userName: config.statisticsDisplayName ? config.statisticsDisplayName : this.myUserId(),
confID: config.confID || `${this.connection.options.hosts.domain}/${this.options.name}`,
siteID: config.siteID,
customScriptUrl: config.callStatsCustomScriptUrl,
callStatsID: config.callStatsID,
callStatsSecret: config.callStatsSecret,
callStatsApplicationLogsDisabled: config.callStatsApplicationLogsDisabled,
roomName: this.options.name,
applicationName: config.applicationName,
configParams: config.callStatsConfigParams
applicationName: config.applicationName
});
Statistics.analytics.addPermanentProperties({
'callstats_name': this._statsCurrentId
Expand Down Expand Up @@ -1237,13 +1232,6 @@ JitsiConference.prototype.onLocalTrackRemoved = function(track) {
track.removeEventListener(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED, track.audioLevelHandler);
}

// send event for stopping screen sharing
// FIXME: we assume we have only one screen sharing track
// if we change this we need to fix this check
if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
this.statistics.sendScreenSharingEvent(false);
}

this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
};

Expand Down Expand Up @@ -1381,17 +1369,6 @@ JitsiConference.prototype._removeLocalSourceOnReject = function(jingleSession, e
JitsiConference.prototype._setupNewTrack = function(newTrack) {
const mediaType = newTrack.getType();

if (newTrack.isAudioTrack() || (newTrack.isVideoTrack() && newTrack.videoType !== VideoType.DESKTOP)) {
// Report active device to statistics
const devices = RTC.getCurrentlyAvailableMediaDevices();
const device = devices
.find(d => d.kind === `${newTrack.getTrack().kind}input` && d.label === newTrack.getTrack().label);

if (device) {
Statistics.sendActiveDeviceListEvent(RTC.getEventDataForActiveDevice(device));
}
}

// Create a source name for this track if it doesn't exist.
if (!newTrack.getSourceName()) {
const sourceName = getSourceNameForJitsiTrack(
Expand Down Expand Up @@ -2256,14 +2233,6 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
this._desktopSharingFrameRate
&& jingleSession.peerconnection.setDesktopSharingFrameRate(this._desktopSharingFrameRate);

// Start callstats as soon as peerconnection is initialized,
// do not wait for XMPPEvents.PEERCONNECTION_READY, as it may never
// happen in case if user doesn't have or denied permission to
// both camera and microphone.
logger.info('Starting CallStats for JVB connection...');
this.statistics.startCallStats(
this.jvbJingleSession.peerconnection,
'jitsi' /* Remote user ID for JVB is 'jitsi' */);
this.statistics.startRemoteStats(this.jvbJingleSession.peerconnection);
} catch (e) {
GlobalOnErrorHandler.callErrorHandler(e);
Expand Down Expand Up @@ -2377,11 +2346,7 @@ JitsiConference.prototype.onCallEnded = function(jingleSession, reasonCondition,

// Stop the stats
if (this.statistics) {
this.statistics.stopRemoteStats(
this.jvbJingleSession.peerconnection);
logger.info('Stopping JVB CallStats');
this.statistics.stopCallStats(
this.jvbJingleSession.peerconnection);
this.statistics.stopRemoteStats(this.jvbJingleSession.peerconnection);
}

// Current JVB JingleSession is no longer valid, so set it to null
Expand Down Expand Up @@ -2694,7 +2659,7 @@ JitsiConference.prototype.getLocalParticipantProperty = function(name) {
};

/**
* Sends the given feedback through CallStats if enabled.
* Sends the given feedback if enabled.
*
* @param overallFeedback an integer between 1 and 5 indicating the
* user feedback
Expand All @@ -2706,14 +2671,10 @@ JitsiConference.prototype.sendFeedback = function(overallFeedback, detailedFeedb
};

/**
* Returns true if the callstats integration is enabled, otherwise returns
* false.
*
* @returns true if the callstats integration is enabled, otherwise returns
* false.
* @returns false, since callstats in not supported anymore.
*/
JitsiConference.prototype.isCallstatsEnabled = function() {
return this.statistics.isCallstatsEnabled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a deprecation notice in the js docs and add a print that this will be removed, wdyt?

return false;
};

/**
Expand All @@ -2727,52 +2688,10 @@ JitsiConference.prototype.getSsrcByTrack = function(track) {
};

/**
* Handles track attached to container (Calls associateStreamWithVideoTag method
* from statistics module)
* @param {JitsiLocalTrack|JitsiRemoteTrack} track the track
* @param container the container
*/
JitsiConference.prototype._onTrackAttach = function(track, container) {
const isLocal = track.isLocal();
let ssrc = null;
const isP2P = track.isP2P;
const remoteUserId = isP2P ? track.getParticipantId() : 'jitsi';
const peerConnection
= isP2P
? this.p2pJingleSession && this.p2pJingleSession.peerconnection
: this.jvbJingleSession && this.jvbJingleSession.peerconnection;

if (isLocal) {
// Local tracks have SSRC stored on per peer connection basis.
if (peerConnection) {
ssrc = peerConnection.getLocalSSRC(track);
}
} else {
ssrc = track.getSSRC();
}
if (!container.id || !ssrc || !peerConnection) {
return;
}

this.statistics.associateStreamWithVideoTag(
peerConnection,
ssrc,
isLocal,
remoteUserId,
track.getUsageLabel(),
container.id);
};

/**
* Logs an "application log" message.
* @param message {string} The message to log. Note that while this can be a
* generic string, the convention used by lib-jitsi-meet and jitsi-meet is to
* log valid JSON strings, with an "id" field used for distinguishing between
* message types. E.g.: {id: "recorder_status", status: "off"}
* This is a no-op since callstats is no longer supported.
*/
JitsiConference.prototype.sendApplicationLog = function(message) {
Statistics.sendLog(message);
};
// eslint-disable-next-line no-empty-function
JitsiConference.prototype.sendApplicationLog = function() { };

/**
* Checks if the user identified by given <tt>mucJid</tt> is the conference focus.
Expand Down Expand Up @@ -2996,20 +2915,6 @@ JitsiConference.prototype._acceptP2PIncomingCall = function(jingleSession, jingl
enableInsertableStreams: this.isE2EEEnabled() || FeatureFlags.isRunInLiteModeEnabled()
});

logger.info('Starting CallStats for P2P connection...');

let remoteID = Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);

const participant = this.participants.get(remoteID);

if (participant) {
remoteID = participant.getStatsID() || remoteID;
}

this.statistics.startCallStats(
this.p2pJingleSession.peerconnection,
remoteID);

const localTracks = this._getInitialLocalTracks();

this.p2pJingleSession.acceptOffer(
Expand Down Expand Up @@ -3295,12 +3200,6 @@ JitsiConference.prototype._setP2PStatus = function(newStatus) {
logger.info('Peer to peer connection closed!');
}

// Put the JVB connection on hold/resume
if (this.jvbJingleSession) {
this.statistics.sendConnectionResumeOrHoldEvent(
this.jvbJingleSession.peerconnection, !newStatus);
}

// Clear dtmfManager, so that it can be recreated with new connection
this.dtmfManager = null;

Expand Down Expand Up @@ -3353,20 +3252,6 @@ JitsiConference.prototype._startP2PSession = function(remoteJid) {
enableInsertableStreams: this.isE2EEEnabled() || FeatureFlags.isRunInLiteModeEnabled()
});

logger.info('Starting CallStats for P2P connection...');

let remoteID = Strophe.getResourceFromJid(this.p2pJingleSession.remoteJid);

const participant = this.participants.get(remoteID);

if (participant) {
remoteID = participant.getStatsID() || remoteID;
}

this.statistics.startCallStats(
this.p2pJingleSession.peerconnection,
remoteID);

const localTracks = this.getLocalTracks();

this.p2pJingleSession.invite(localTracks);
Expand Down Expand Up @@ -3520,8 +3405,6 @@ JitsiConference.prototype._stopP2PSession = function(options = {}) {
// Stop P2P stats
logger.info('Stopping remote stats for P2P connection');
this.statistics.stopRemoteStats(this.p2pJingleSession.peerconnection);
logger.info('Stopping CallStats for P2P connection');
this.statistics.stopCallStats(this.p2pJingleSession.peerconnection);

this.p2pJingleSession.terminate(
() => {
Expand Down
88 changes: 1 addition & 87 deletions JitsiConferenceEventManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Statistics from './modules/statistics/statistics';
import EventEmitterForwarder from './modules/util/EventEmitterForwarder';
import { MediaType } from './service/RTC/MediaType';
import RTCEvents from './service/RTC/RTCEvents';
import { VideoType } from './service/RTC/VideoType';
import AuthenticationEvents
from './service/authentication/AuthenticationEvents';
import {
Expand All @@ -31,26 +30,6 @@ const logger = getLogger(__filename);
export default function JitsiConferenceEventManager(conference) {
this.conference = conference;
this.xmppListeners = {};

// Listeners related to the conference only
conference.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED,
track => {
if (!track.isLocal() || !conference.statistics) {
return;
}
const session
= track.isP2P
? conference.p2pJingleSession : conference.jvbJingleSession;

// TPC will be null, before the conference starts, but the event
// still should be queued
const tpc = (session && session.peerconnection) || null;

conference.statistics.sendMuteEvent(
tpc,
track.isMuted(),
track.getType());
});
}

/**
Expand Down Expand Up @@ -360,20 +339,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {

chatRoom.addListener(XMPPEvents.LOCAL_ROLE_CHANGED, role => {
conference.onLocalRoleChanged(role);

// log all events for the recorder operated by the moderator
if (conference.statistics && conference.isModerator()) {
conference.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED,
recorderSession => {
const logObject = {
error: recorderSession.getError(),
id: 'recorder_status',
status: recorderSession.getStatus()
};

Statistics.sendLog(JSON.stringify(logObject));
});
}
});

chatRoom.addListener(XMPPEvents.MUC_ROLE_CHANGED,
Expand Down Expand Up @@ -475,21 +440,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
}
});

if (conference.statistics) {
// FIXME ICE related events should end up in RTCEvents eventually
chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
session => {
conference.statistics.sendIceConnectionFailedEvent(
session.peerconnection);
});

// FIXME XMPPEvents.ADD_ICE_CANDIDATE_FAILED is never emitted
chatRoom.addListener(XMPPEvents.ADD_ICE_CANDIDATE_FAILED,
(e, pc) => {
conference.statistics.sendAddIceCandidateFailed(e, pc);
});
}

// Breakout rooms.
this.chatRoomForwarder.forward(XMPPEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM,
JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM);
Expand Down Expand Up @@ -526,7 +476,7 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, dominant, previous, silence);
if (conference.statistics && conference.myUserId() === dominant) {
// We are the new dominant speaker.
conference.statistics.sendDominantSpeakerEvent(conference.room.roomjid, silence);
conference.xmpp.sendDominantSpeakerEvent(conference.room.roomjid, silence);
}
if (conference.lastDominantSpeaker !== dominant) {
if (previous && previous.length) {
Expand Down Expand Up @@ -603,30 +553,8 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
}
});

rtc.addListener(RTCEvents.LOCAL_UFRAG_CHANGED,
(tpc, ufrag) => {
if (!tpc.isP2P) {
Statistics.sendLog(
JSON.stringify({
id: 'local_ufrag',
value: ufrag
}));
}
});
rtc.addListener(RTCEvents.REMOTE_UFRAG_CHANGED,
(tpc, ufrag) => {
if (!tpc.isP2P) {
Statistics.sendLog(
JSON.stringify({
id: 'remote_ufrag',
value: ufrag
}));
}
});

rtc.addListener(RTCEvents.CREATE_ANSWER_FAILED,
(e, tpc) => {
conference.statistics.sendCreateAnswerFailed(e, tpc);
if (!tpc.isP2P) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
Expand All @@ -635,7 +563,6 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {

rtc.addListener(RTCEvents.CREATE_OFFER_FAILED,
(e, tpc) => {
conference.statistics.sendCreateOfferFailed(e, tpc);
if (!tpc.isP2P) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
Expand All @@ -644,7 +571,6 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {

rtc.addListener(RTCEvents.SET_LOCAL_DESCRIPTION_FAILED,
(e, tpc) => {
conference.statistics.sendSetLocalDescFailed(e, tpc);
if (!tpc.isP2P) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
Expand All @@ -653,23 +579,11 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {

rtc.addListener(RTCEvents.SET_REMOTE_DESCRIPTION_FAILED,
(e, tpc) => {
conference.statistics.sendSetRemoteDescFailed(e, tpc);
if (!tpc.isP2P) {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
}
});

rtc.addListener(RTCEvents.LOCAL_TRACK_SSRC_UPDATED,
(track, ssrc) => {
// when starting screen sharing, the track is created and when
// we do set local description and we process the ssrc we
// will be notified for it and we will report it with the event
// for screen sharing
if (track.isVideoTrack() && track.videoType === VideoType.DESKTOP) {
conference.statistics.sendScreenSharingEvent(true, ssrc);
}
});
};

/**
Expand Down
3 changes: 1 addition & 2 deletions JitsiConferenceEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export enum JitsiConferenceEvents {

/**
* Fired just before the statistics module is disposed and it's the last chance
* to submit some logs to the statistics service (ex. CallStats if enabled),
* before it's disconnected.
* to submit some logs to the statistics service before it's disconnected.
*/
BEFORE_STATISTICS_DISPOSED = 'conference.beforeStatisticsDisposed',

Expand Down
Loading