@webex/internal-plugin-metrics 3.12.0-webex-services-ready.2 → 3.12.0-webex-services-ready.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-user.js +19 -0
- package/dist/automated-user.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +0 -23
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +571 -15
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +51 -26
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js +4 -0
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +16 -6
- package/dist/new-metrics.js.map +1 -1
- package/dist/prelogin-metrics-batcher.js +0 -23
- package/dist/prelogin-metrics-batcher.js.map +1 -1
- package/dist/types/automated-user.d.ts +2 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +199 -5
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +27 -2
- package/dist/types/index.d.ts +5 -3
- package/dist/types/metrics.types.d.ts +4 -2
- package/dist/types/new-metrics.d.ts +4 -0
- package/package.json +12 -11
- package/src/automated-user.ts +16 -0
- package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +0 -26
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +661 -5
- package/src/call-diagnostic/call-diagnostic-metrics.ts +40 -18
- package/src/index.ts +5 -0
- package/src/metrics.types.ts +15 -2
- package/src/new-metrics.ts +12 -4
- package/src/prelogin-metrics-batcher.ts +0 -26
- package/test/unit/spec/automated-user.ts +43 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +0 -136
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +1192 -16
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +75 -11
- package/test/unit/spec/new-metrics.ts +13 -2
- package/test/unit/spec/prelogin-metrics-batcher.ts +1 -120
|
@@ -27,7 +27,7 @@ type GetIdentifiersOptions = {
|
|
|
27
27
|
export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
28
28
|
private callDiagnosticEventsBatcher;
|
|
29
29
|
private preLoginMetricsBatcher;
|
|
30
|
-
private logger;
|
|
30
|
+
private get logger();
|
|
31
31
|
private hasLoggedBrowserSerial;
|
|
32
32
|
private device;
|
|
33
33
|
private delayedClientEvents;
|
|
@@ -55,6 +55,14 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
55
55
|
* @returns one of 'login-ci','unverified-guest', null
|
|
56
56
|
*/
|
|
57
57
|
getCurLoginType(): "unverified-guest" | "login-ci";
|
|
58
|
+
/**
|
|
59
|
+
* Returns the user activation state reported from the browser's navigator.userActivation API
|
|
60
|
+
* @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
|
|
61
|
+
*/
|
|
62
|
+
getUserActivation(): {
|
|
63
|
+
hasBeenActive: boolean;
|
|
64
|
+
isActive: boolean;
|
|
65
|
+
} | undefined;
|
|
58
66
|
/**
|
|
59
67
|
* Returns the telemetryOptOut value of the current user
|
|
60
68
|
* @returns one of 'manual', 'automatic', undefined
|
|
@@ -131,6 +139,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
131
139
|
clientVersionStatus?: "CURRENT" | "LEGACY" | "UNSUPPORTED";
|
|
132
140
|
localClientVersion?: string;
|
|
133
141
|
launcherVersion?: string;
|
|
142
|
+
installerVersion?: string;
|
|
143
|
+
installerMajorVersion?: number;
|
|
144
|
+
installerMinorVersion?: number;
|
|
145
|
+
installerRevision?: number;
|
|
134
146
|
modelNumber?: string;
|
|
135
147
|
joinFirstUpdateLater?: "ep-enabled" | "sp-enabled" | "not-enabled";
|
|
136
148
|
standbyUsed?: boolean;
|
|
@@ -177,6 +189,14 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
177
189
|
preInstalledVersion?: string;
|
|
178
190
|
additionalProperties?: never;
|
|
179
191
|
};
|
|
192
|
+
installerInfo?: {
|
|
193
|
+
packageSuffix?: string;
|
|
194
|
+
packageArch?: string;
|
|
195
|
+
launchId?: string;
|
|
196
|
+
packageCount?: number;
|
|
197
|
+
totalSize?: number;
|
|
198
|
+
additionalProperties?: never;
|
|
199
|
+
};
|
|
180
200
|
emmVendorId?: string;
|
|
181
201
|
isHybridMedia?: boolean;
|
|
182
202
|
originData?: {};
|
|
@@ -194,6 +214,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
194
214
|
participantId?: string;
|
|
195
215
|
breakoutGroupId?: string;
|
|
196
216
|
breakoutMoveId?: string;
|
|
217
|
+
breakoutTrackingId?: string;
|
|
197
218
|
breakoutSessionId?: string;
|
|
198
219
|
browserId?: string;
|
|
199
220
|
ciExchangeTokenUrl?: string;
|
|
@@ -240,6 +261,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
240
261
|
msteamsTenantGuid?: string;
|
|
241
262
|
msteamsConferenceId?: string;
|
|
242
263
|
msteamsMeetingId?: string;
|
|
264
|
+
mtid?: string;
|
|
243
265
|
oauth2ClientId?: string;
|
|
244
266
|
orgId?: string;
|
|
245
267
|
provisionalCorrelationId?: string;
|
|
@@ -285,6 +307,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
285
307
|
participantId?: string;
|
|
286
308
|
breakoutGroupId?: string;
|
|
287
309
|
breakoutMoveId?: string;
|
|
310
|
+
breakoutTrackingId?: string;
|
|
288
311
|
breakoutSessionId?: string;
|
|
289
312
|
browserId?: string;
|
|
290
313
|
ciExchangeTokenUrl?: string;
|
|
@@ -331,6 +354,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
331
354
|
msteamsTenantGuid?: string;
|
|
332
355
|
msteamsConferenceId?: string;
|
|
333
356
|
msteamsMeetingId?: string;
|
|
357
|
+
mtid?: string;
|
|
334
358
|
oauth2ClientId?: string;
|
|
335
359
|
orgId?: string;
|
|
336
360
|
provisionalCorrelationId?: string;
|
|
@@ -376,6 +400,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
376
400
|
participantId?: string;
|
|
377
401
|
breakoutGroupId?: string;
|
|
378
402
|
breakoutMoveId?: string;
|
|
403
|
+
breakoutTrackingId?: string;
|
|
379
404
|
breakoutSessionId?: string;
|
|
380
405
|
browserId?: string;
|
|
381
406
|
ciExchangeTokenUrl?: string;
|
|
@@ -422,6 +447,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
422
447
|
msteamsTenantGuid?: string;
|
|
423
448
|
msteamsConferenceId?: string;
|
|
424
449
|
msteamsMeetingId?: string;
|
|
450
|
+
mtid?: string;
|
|
425
451
|
oauth2ClientId?: string;
|
|
426
452
|
orgId?: string;
|
|
427
453
|
provisionalCorrelationId?: string;
|
|
@@ -631,7 +657,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
631
657
|
* Prepare the event and send the request to metrics-a service, pre login.
|
|
632
658
|
* @param event
|
|
633
659
|
* @param preLoginId
|
|
634
|
-
* @param markTelemetryOptOutOnResponse
|
|
635
660
|
* @returns
|
|
636
661
|
*/
|
|
637
662
|
submitToCallDiagnosticsPreLogin: (event: Event, preLoginId?: string) => Promise<any>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import config from './config';
|
|
5
5
|
import NewMetrics from './new-metrics';
|
|
6
6
|
import * as Utils from './utils';
|
|
7
|
-
import
|
|
7
|
+
import * as AutomatedUserUtils from './automated-user';
|
|
8
|
+
import { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitOperationalEvent, SubmitBusinessEvent, SubmitMQE, PreComputedLatencies, SubmitFeatureEvent, LocusSyncLatencyEventName } from './metrics.types';
|
|
8
9
|
import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
|
|
9
10
|
import * as CallDiagnosticUtils from './call-diagnostic/call-diagnostic-metrics.util';
|
|
10
11
|
import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
|
|
@@ -15,5 +16,6 @@ import BusinessMetrics from './business-metrics';
|
|
|
15
16
|
import RtcMetrics from './rtcMetrics';
|
|
16
17
|
import PreLoginMetrics from './prelogin-metrics';
|
|
17
18
|
export { default, getOSNameInternal } from './metrics';
|
|
18
|
-
export { config, CALL_DIAGNOSTIC_CONFIG, NewMetrics, Utils, CallDiagnosticUtils, CallDiagnosticLatencies, CallDiagnosticMetrics, BehavioralMetrics, OperationalMetrics, BusinessMetrics, RtcMetrics, PreLoginMetrics, };
|
|
19
|
-
export
|
|
19
|
+
export { config, CALL_DIAGNOSTIC_CONFIG, AutomatedUserUtils, NewMetrics, Utils, CallDiagnosticUtils, CallDiagnosticLatencies, CallDiagnosticMetrics, BehavioralMetrics, OperationalMetrics, BusinessMetrics, RtcMetrics, PreLoginMetrics, };
|
|
20
|
+
export { isAutomatedUser, isAutomatedUserAgent } from './automated-user';
|
|
21
|
+
export type { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitMQE, SubmitOperationalEvent, SubmitBusinessEvent, PreComputedLatencies, SubmitFeatureEvent, LocusSyncLatencyEventName, };
|
|
@@ -41,8 +41,10 @@ export type SubmitMQEOptions = {
|
|
|
41
41
|
webexConferenceIdStr?: string;
|
|
42
42
|
globalMeetingId?: string;
|
|
43
43
|
};
|
|
44
|
+
export declare const LOCUS_SYNC_LATENCY_EVENT_NAMES: readonly ["internal.client.locus.sync.start", "internal.client.locus.hashtree.request", "internal.client.locus.hashtree.response", "internal.client.locus.sync.request", "internal.client.locus.sync.response", "internal.client.locus.sync.message.received"];
|
|
45
|
+
export type LocusSyncLatencyEventName = (typeof LOCUS_SYNC_LATENCY_EVENT_NAMES)[number];
|
|
44
46
|
export type InternalEvent = {
|
|
45
|
-
name: 'internal.client.meetinginfo.request' | 'internal.client.meetinginfo.response' | 'internal.register.device.request' | 'internal.register.device.response' | 'internal.reset.join.latencies' | 'internal.host.meeting.participant.admitted' | 'internal.client.meeting.interstitial-window.showed' | 'internal.client.interstitial-window.click.joinbutton' | 'internal.client.add-media.turn-discovery.start' | 'internal.client.add-media.turn-discovery.end' | 'internal.client.share.initiated' | 'internal.client.share.stopped';
|
|
47
|
+
name: 'internal.client.meetinginfo.request' | 'internal.client.meetinginfo.response' | 'internal.register.device.request' | 'internal.register.device.response' | 'internal.reset.join.latencies' | 'internal.host.meeting.participant.admitted' | 'internal.client.meeting.interstitial-window.showed' | 'internal.client.interstitial-window.click.joinbutton' | 'internal.client.add-media.turn-discovery.start' | 'internal.client.add-media.turn-discovery.end' | 'internal.client.share.initiated' | 'internal.client.share.stopped' | LocusSyncLatencyEventName;
|
|
46
48
|
payload?: never;
|
|
47
49
|
options?: never;
|
|
48
50
|
};
|
|
@@ -154,7 +156,7 @@ export type BuildClientEventFetchRequestOptions = (args: {
|
|
|
154
156
|
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
155
157
|
options?: SubmitClientEventOptions;
|
|
156
158
|
}) => Promise<any>;
|
|
157
|
-
export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.get.cluster.time' | 'internal.click.to.interstitial' | 'internal.click.to.interstitial.with.user.delay' | 'internal.click.to.interstitial.for.client.jmt' | 'internal.refresh.captcha.time' | 'internal.exchange.ci.token.time' | 'internal.get.u2c.time' | 'internal.call.init.join.req' | 'internal.other.app.api.time' | 'internal.api.fetch.intelligence.models';
|
|
159
|
+
export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.get.cluster.time' | 'internal.click.to.interstitial' | 'internal.click.to.interstitial.with.user.delay' | 'internal.click.to.interstitial.for.client.jmt' | 'internal.refresh.captcha.time' | 'internal.exchange.ci.token.time' | 'internal.get.u2c.time' | 'internal.call.init.join.req' | 'internal.other.app.api.time' | 'internal.api.fetch.intelligence.models' | 'internal.client.locus.sync.random.backoff';
|
|
158
160
|
export interface IdType {
|
|
159
161
|
meetingId?: string;
|
|
160
162
|
callId?: string;
|
|
@@ -78,6 +78,10 @@ declare class Metrics extends WebexPlugin {
|
|
|
78
78
|
* @returns true once we have the deviceId we need to submit business events
|
|
79
79
|
*/
|
|
80
80
|
isReadyToSubmitBusinessEvents(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* @returns whether the current user agent belongs to an automated user
|
|
83
|
+
*/
|
|
84
|
+
isAutomatedUser(): boolean;
|
|
81
85
|
/**
|
|
82
86
|
* Behavioral event
|
|
83
87
|
* @param args
|
package/package.json
CHANGED
|
@@ -24,24 +24,25 @@
|
|
|
24
24
|
"@sinonjs/fake-timers": "^6.0.1",
|
|
25
25
|
"@webex/babel-config-legacy": "0.0.0",
|
|
26
26
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
27
|
-
"@webex/event-dictionary-ts": "^1.0.2191",
|
|
28
27
|
"@webex/jest-config-legacy": "0.0.0",
|
|
29
28
|
"@webex/legacy-tools": "0.0.0",
|
|
30
|
-
"@webex/test-helper-chai": "3.12.0-webex-services-ready.
|
|
31
|
-
"@webex/test-helper-mocha": "3.12.0-webex-services-ready.
|
|
32
|
-
"@webex/test-helper-mock-webex": "3.12.0-webex-services-ready.
|
|
33
|
-
"@webex/test-helper-test-users": "3.12.0-webex-services-ready.
|
|
29
|
+
"@webex/test-helper-chai": "3.12.0-webex-services-ready.4",
|
|
30
|
+
"@webex/test-helper-mocha": "3.12.0-webex-services-ready.4",
|
|
31
|
+
"@webex/test-helper-mock-webex": "3.12.0-webex-services-ready.4",
|
|
32
|
+
"@webex/test-helper-test-users": "3.12.0-webex-services-ready.4",
|
|
34
33
|
"eslint": "^8.24.0",
|
|
35
34
|
"prettier": "^2.7.1",
|
|
36
35
|
"sinon": "^9.2.4"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@webex/common": "3.12.0-webex-services-ready.
|
|
40
|
-
"@webex/common-timers": "3.12.0-webex-services-ready.
|
|
41
|
-
"@webex/
|
|
42
|
-
"@webex/test-helper-
|
|
43
|
-
"@webex/webex
|
|
38
|
+
"@webex/common": "3.12.0-webex-services-ready.4",
|
|
39
|
+
"@webex/common-timers": "3.12.0-webex-services-ready.4",
|
|
40
|
+
"@webex/event-dictionary-ts": "^1.0.2215",
|
|
41
|
+
"@webex/test-helper-chai": "3.12.0-webex-services-ready.4",
|
|
42
|
+
"@webex/test-helper-mock-webex": "3.12.0-webex-services-ready.4",
|
|
43
|
+
"@webex/webex-core": "3.12.0-webex-services-ready.4",
|
|
44
44
|
"ip-anonymize": "^0.1.0",
|
|
45
|
+
"isbot": "5.2.1",
|
|
45
46
|
"lodash": "^4.17.21",
|
|
46
47
|
"uuid": "^3.3.2"
|
|
47
48
|
},
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"test:style": "eslint ./src/**/*.*",
|
|
54
55
|
"test:unit": "webex-legacy-tools test --unit --runner mocha"
|
|
55
56
|
},
|
|
56
|
-
"version": "3.12.0-webex-services-ready.
|
|
57
|
+
"version": "3.12.0-webex-services-ready.4"
|
|
57
58
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {isBot} from 'isbot';
|
|
2
|
+
|
|
3
|
+
export const isAutomatedUserAgent = (userAgent?: string | null): boolean => isBot(userAgent);
|
|
4
|
+
|
|
5
|
+
let automatedUser: boolean | undefined;
|
|
6
|
+
|
|
7
|
+
export const isAutomatedUser = (): boolean => {
|
|
8
|
+
if (automatedUser === undefined) {
|
|
9
|
+
automatedUser =
|
|
10
|
+
typeof window !== 'undefined' &&
|
|
11
|
+
typeof navigator !== 'undefined' &&
|
|
12
|
+
(Boolean(navigator.webdriver) || isAutomatedUserAgent(navigator.userAgent));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return automatedUser;
|
|
16
|
+
};
|
|
@@ -55,8 +55,6 @@ const CallDiagnosticEventsBatcher = Batcher.extend({
|
|
|
55
55
|
`CallDiagnosticEventsBatcher: @submitHttpRequest#${batchId}. Request successful.`
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
-
this.handleHttpResponseStatus(res?.statusCode, payload);
|
|
59
|
-
|
|
60
58
|
return res;
|
|
61
59
|
})
|
|
62
60
|
.catch((err) => {
|
|
@@ -66,33 +64,9 @@ const CallDiagnosticEventsBatcher = Batcher.extend({
|
|
|
66
64
|
`error: ${generateCommonErrorMetadata(err)}`
|
|
67
65
|
);
|
|
68
66
|
|
|
69
|
-
this.handleHttpResponseStatus(err?.statusCode, payload);
|
|
70
|
-
|
|
71
67
|
return Promise.reject(err);
|
|
72
68
|
});
|
|
73
69
|
},
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* React to the HTTP status code returned by the metrics endpoint.
|
|
77
|
-
* Only items submitted with `markTelemetryOptOutOnResponse: true` opt into
|
|
78
|
-
* this behavior.
|
|
79
|
-
* @param {number | undefined} statusCode
|
|
80
|
-
* @param {any[]} payload Items flushed in this HTTP batch.
|
|
81
|
-
* @returns {void}
|
|
82
|
-
*/
|
|
83
|
-
handleHttpResponseStatus(statusCode: number | undefined, payload: any[]) {
|
|
84
|
-
const shouldMark =
|
|
85
|
-
Array.isArray(payload) &&
|
|
86
|
-
payload.some((item) => item?.markTelemetryOptOutOnResponse === true);
|
|
87
|
-
|
|
88
|
-
if (!shouldMark) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (statusCode === 200) {
|
|
93
|
-
this.webex.internal.newMetrics?.callDiagnosticMetrics?.setIsTelemetryOptOutAutomatic(true);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
70
|
});
|
|
97
71
|
|
|
98
72
|
export default CallDiagnosticEventsBatcher;
|