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

Cherry-pick commits from beta into next - 26-4-2024 #3573

Merged
merged 8 commits into from
Apr 26, 2024
2 changes: 1 addition & 1 deletion packages/@webex/internal-plugin-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {
"@webex/common": "workspace:*",
"@webex/common-timers": "workspace:*",
"@webex/event-dictionary-ts": "^1.0.1401",
"@webex/event-dictionary-ts": "^1.0.1406",
"@webex/internal-plugin-device": "workspace:*",
"@webex/internal-plugin-metrics": "workspace:*",
"@webex/test-helper-chai": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,15 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');
}

/**
* Total latency for all exchange ci token.
*/
public getExchangeCITokenJMT() {
const exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');

return exchangeCITokenJMT ? Math.floor(exchangeCITokenJMT) : undefined;
}

/**
* Total latency for all refresh captcha requests.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
ClientInfo,
ClientEventPayloadError,
ClientSubServiceType,
BrowserLaunchMethodType,
} from '../metrics.types';
import CallDiagnosticEventsBatcher from './call-diagnostic-metrics-batcher';
import PreLoginMetricsBatcher from '../prelogin-metrics-batcher';
Expand All @@ -65,6 +66,7 @@ type GetOriginOptions = {
subClientType: SubClientType;
networkType?: NetworkType;
clientLaunchMethod?: ClientLaunchMethodType;
browserLaunchMethod?: BrowserLaunchMethodType;
environment?: EnvironmentType;
newEnvironment?: NewEnvironmentType;
};
Expand Down Expand Up @@ -258,6 +260,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
origin.clientInfo.clientLaunchMethod = options.clientLaunchMethod;
}

if (options?.browserLaunchMethod) {
origin.clientInfo.browserLaunchMethod = options.browserLaunchMethod;
}

return origin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export const prepareDiagnosticMetricItem = (webex: any, item: any) => {
break;
case 'client.login.end':
joinTimes.otherAppApiReqResp = cdl.getOtherAppApiReqResp();
joinTimes.exchangeCITokenJMT = cdl.getExchangeCITokenJMT();
break;
case 'client.interstitial-window.launched':
joinTimes.meetingInfoReqResp = cdl.getMeetingInfoReqResp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export type ClientLaunchMethodType = NonNullable<
RawEvent['origin']['clientInfo']
>['clientLaunchMethod'];

export type BrowserLaunchMethodType = NonNullable<
RawEvent['origin']['clientInfo']
>['browserLaunchMethod'];

export type SubmitClientEventOptions = {
meetingId?: string;
mediaConnections?: any[];
Expand All @@ -25,6 +29,7 @@ export type SubmitClientEventOptions = {
environment?: EnvironmentType;
newEnvironmentType?: NewEnvironmentType;
clientLaunchMethod?: ClientLaunchMethodType;
browserLaunchMethod?: BrowserLaunchMethodType;
webexConferenceIdStr?: string;
globalMeetingId?: string;
};
Expand Down Expand Up @@ -166,6 +171,7 @@ export type PreComputedLatencies =
| 'internal.download.time'
| 'internal.click.to.interstitial'
| 'internal.refresh.captcha.time'
| 'internal.exchange.ci.token.time'
| 'internal.get.u2c.time'
| 'internal.call.init.join.req'
| 'internal.other.app.api.time';
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ describe('internal-plugin-metrics', () => {
});
});

describe('getExchangeCITokenJMT', () => {
it('returns undefined when no precomputed value available', () => {
assert.deepEqual(cdl.getExchangeCITokenJMT(), undefined);
});

it('returns the correct value', () => {
cdl.saveLatency('internal.exchange.ci.token.time', 123);

assert.deepEqual(cdl.getExchangeCITokenJMT(), 123);
});

it('returns the correct whole number', () => {
cdl.saveLatency('internal.exchange.ci.token.time', 321.44);

assert.deepEqual(cdl.getExchangeCITokenJMT(), 321);
});
});

describe('saveTimestamp', () => {
afterEach(() => {
sinon.restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,43 @@ describe('internal-plugin-metrics', () => {
});
});

it('should build origin correctly with browserLaunchMethod', () => {
sinon.stub(CallDiagnosticUtils, 'anonymizeIPAddress').returns('1.1.1.1');

//@ts-ignore
const res = cd.getOrigin(
{
subClientType: 'WEB_APP',
clientType: 'TEAMS_CLIENT',
newEnvironment: 'test-new-env',
clientLaunchMethod: 'url-handler',
browserLaunchMethod: 'thinclient',
},
fakeMeeting.id
);

assert.deepEqual(res, {
clientInfo: {
browser: getBrowserName(),
browserVersion: getBrowserVersion(),
clientType: 'TEAMS_CLIENT',
clientVersion: 'webex-js-sdk/webex-version',
publicNetworkPrefix: '1.1.1.1',
localNetworkPrefix: '1.1.1.1',
os: getOSNameInternal(),
osVersion: getOSVersion(),
subClientType: 'WEB_APP',
clientLaunchMethod: 'url-handler',
browserLaunchMethod: 'thinclient',
},
environment: 'meeting_evn',
newEnvironment: 'test-new-env',
name: 'endpoint',
networkType: 'unknown',
userAgent,
});
});

it('should build origin correctly with no meeting', () => {
sinon.stub(CallDiagnosticUtils, 'anonymizeIPAddress').returns('1.1.1.1');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ describe('internal-plugin-metrics', () => {
['client.login.end', {
joinTimes: {
otherAppApiReqResp: undefined,
exchangeCITokenJMT: undefined,
}
}],
['client.webexapp.launched', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@webex/media-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@webex/internal-media-core": "2.3.2",
"@webex/ts-events": "^1.1.0",
"@webex/web-media-effects": "^2.15.6"
"@webex/web-media-effects": "2.18.0"
},
"browserify": {
"transform": [
Expand Down
4 changes: 2 additions & 2 deletions packages/@webex/plugin-meetings/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const ICE_FAIL_TIMEOUT = 3000;

export const RETRY_TIMEOUT = 3000;

export const ICE_AND_DTLS_CONNECTION_TIMEOUT = 10000;
export const ICE_AND_DTLS_CONNECTION_TIMEOUT = 20000;
export const ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT = 35000;

// ******************** REGEX **********************
Expand Down Expand Up @@ -972,7 +972,7 @@ export const SELF_ROLES = {
COHOST: 'COHOST',
MODERATOR: 'MODERATOR',
ATTENDEE: 'ATTENDEE',
PRESENTER: 'PRESENTER',
PANELIST: 'PANELIST',
};

export const MEETING_STATE = {
Expand Down
38 changes: 34 additions & 4 deletions packages/@webex/plugin-meetings/src/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
ClientEventLeaveReason,
CallDiagnosticUtils,
} from '@webex/internal-plugin-metrics';
import {ClientEvent as RawClientEvent} from '@webex/event-dictionary-ts';

import {
ConnectionState,
Errors,
Expand Down Expand Up @@ -6052,6 +6054,20 @@ export default class Meeting extends StatelessWebexPlugin {
meetingId: this.id,
},
});

if (data.type === 'share') {
// @ts-ignore
this.webex.internal.newMetrics.submitClientEvent({
name: 'client.media.render.start',
payload: {
mediaType: 'share',
shareInstanceId: this.remoteShareInstanceId,
},
options: {
meetingId: this.id,
},
});
}
});
this.statsAnalyzer.on(StatsAnalyzerEvents.REMOTE_MEDIA_STOPPED, (data) => {
// @ts-ignore
Expand All @@ -6065,6 +6081,20 @@ export default class Meeting extends StatelessWebexPlugin {
meetingId: this.id,
},
});

if (data.type === 'share') {
// @ts-ignore
this.webex.internal.newMetrics.submitClientEvent({
name: 'client.media.render.stop',
payload: {
mediaType: 'share',
shareInstanceId: this.remoteShareInstanceId,
},
options: {
meetingId: this.id,
},
});
}
});
};

Expand Down Expand Up @@ -7913,9 +7943,9 @@ export default class Meeting extends StatelessWebexPlugin {

/**
*
* @returns {string} one of 'attendee','host','cohost', returns the user type of the current user
* @returns {string} one of 'panelist', 'attendee', 'host', 'cohost', returns the user type of the current user
*/
getCurUserType() {
getCurUserType(): RawClientEvent['userType'] | null {
const {roles} = this;
if (roles) {
if (roles.includes(SELF_ROLES.MODERATOR)) {
Expand All @@ -7924,8 +7954,8 @@ export default class Meeting extends StatelessWebexPlugin {
if (roles.includes(SELF_ROLES.COHOST)) {
return 'cohost';
}
if (roles.includes(SELF_ROLES.PRESENTER)) {
return 'presenter';
if (roles.includes(SELF_ROLES.PANELIST)) {
return 'panelist';
}
if (roles.includes(SELF_ROLES.ATTENDEE)) {
return 'attendee';
Expand Down
Loading
Loading