@webex/internal-plugin-metrics 3.0.0-bnr.4 → 3.0.0
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/.eslintrc.js +6 -0
- package/babel.config.js +3 -0
- package/dist/batcher.js +41 -3
- package/dist/batcher.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +64 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +474 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.js +849 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +349 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
- package/dist/call-diagnostic/config.js +609 -0
- package/dist/call-diagnostic/config.js.map +1 -0
- package/dist/client-metrics-batcher.js +3 -3
- package/dist/client-metrics-batcher.js.map +1 -1
- package/dist/config.js +6 -9
- package/dist/config.js.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +24 -22
- package/dist/metrics.js.map +1 -1
- package/dist/metrics.types.js +7 -0
- package/dist/metrics.types.js.map +1 -0
- package/dist/new-metrics.js +302 -0
- package/dist/new-metrics.js.map +1 -0
- package/dist/prelogin-metrics-batcher.js +81 -0
- package/dist/prelogin-metrics-batcher.js.map +1 -0
- package/dist/types/batcher.d.ts +5 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +204 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +427 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +103 -0
- package/dist/types/call-diagnostic/config.d.ts +178 -0
- package/dist/types/config.d.ts +18 -0
- package/dist/types/index.d.ts +15 -3
- package/dist/types/metrics.d.ts +1 -0
- package/dist/types/metrics.types.d.ts +105 -0
- package/dist/types/new-metrics.d.ts +131 -0
- package/dist/types/prelogin-metrics-batcher.d.ts +2 -0
- package/dist/types/utils.d.ts +6 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/jest.config.js +3 -0
- package/package.json +34 -10
- package/process +1 -0
- package/src/batcher.js +38 -0
- package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +72 -0
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +435 -0
- package/src/call-diagnostic/call-diagnostic-metrics.ts +912 -0
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +392 -0
- package/src/call-diagnostic/config.ts +685 -0
- package/src/client-metrics-batcher.js +1 -0
- package/src/config.js +1 -0
- package/src/index.ts +54 -0
- package/src/metrics.js +17 -16
- package/src/metrics.types.ts +168 -0
- package/src/new-metrics.ts +278 -0
- package/src/prelogin-metrics-batcher.ts +95 -0
- package/src/utils.ts +17 -0
- package/test/unit/spec/batcher.js +2 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +458 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +520 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +2276 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +628 -0
- package/test/unit/spec/client-metrics-batcher.js +2 -0
- package/test/unit/spec/metrics.js +68 -95
- package/test/unit/spec/new-metrics.ts +233 -0
- package/test/unit/spec/prelogin-metrics-batcher.ts +250 -0
- package/test/unit/spec/utils.ts +22 -0
- package/tsconfig.json +6 -0
- package/dist/call-diagnostic-events-batcher.js +0 -60
- package/dist/call-diagnostic-events-batcher.js.map +0 -1
- package/dist/internal-plugin-metrics.d.ts +0 -21
- package/dist/tsdoc-metadata.json +0 -11
- package/src/call-diagnostic-events-batcher.js +0 -62
- package/src/index.js +0 -17
- package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
- package/dist/types/{call-diagnostic-events-batcher.d.ts → call-diagnostic/call-diagnostic-metrics-batcher.d.ts} +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { ClientEventError, ClientSubServiceType } from '../metrics.types';
|
|
2
|
+
export declare const CALL_DIAGNOSTIC_LOG_IDENTIFIER = "call-diagnostic-events -> ";
|
|
3
|
+
export declare const AUTHENTICATION_FAILED_CODE = 1010;
|
|
4
|
+
export declare const NETWORK_ERROR = 1026;
|
|
5
|
+
export declare const NEW_LOCUS_ERROR_CLIENT_CODE = 4008;
|
|
6
|
+
export declare const MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE = 4100;
|
|
7
|
+
export declare const UNKNOWN_ERROR = 9999;
|
|
8
|
+
export declare const ICE_FAILURE_CLIENT_CODE = 2004;
|
|
9
|
+
export declare const MISSING_ROAP_ANSWER_CLIENT_CODE = 2007;
|
|
10
|
+
export declare const DTLS_HANDSHAKE_FAILED_CLIENT_CODE = 2008;
|
|
11
|
+
export declare const ICE_FAILED_WITH_TURN_TLS_CLIENT_CODE = 2010;
|
|
12
|
+
export declare const ICE_FAILED_WITHOUT_TURN_TLS_CLIENT_CODE = 2009;
|
|
13
|
+
export declare const WBX_APP_API_URL = "wbxappapi";
|
|
14
|
+
export declare const WEBEX_SUB_SERVICE_TYPES: Record<string, ClientSubServiceType>;
|
|
15
|
+
export declare const BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP: {
|
|
16
|
+
[x: string]: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const SDP_OFFER_CREATION_ERROR_MAP: {
|
|
19
|
+
GENERAL: number;
|
|
20
|
+
SDP_MUNGE_MISSING_CODECS: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const ERROR_DESCRIPTIONS: {
|
|
23
|
+
UNKNOWN_CALL_FAILURE: string;
|
|
24
|
+
LOCUS_RATE_LIMITED_INCOMING: string;
|
|
25
|
+
LOCUS_RATE_LIMITED_OUTGOING: string;
|
|
26
|
+
LOCUS_UNAVAILABLE: string;
|
|
27
|
+
LOCUS_CONFLICT: string;
|
|
28
|
+
TIMEOUT: string;
|
|
29
|
+
LOCUS_INVALID_SEQUENCE_HASH: string;
|
|
30
|
+
AUTHENTICATION_FAILED: string;
|
|
31
|
+
NETWORK_ERROR: string;
|
|
32
|
+
UPDATE_MEDIA_FAILED: string;
|
|
33
|
+
FAILED_TO_CONNECT_MEDIA: string;
|
|
34
|
+
MEDIA_ENGINE_LOST: string;
|
|
35
|
+
MEDIA_CONNECTION_LOST: string;
|
|
36
|
+
ICE_FAILURE: string;
|
|
37
|
+
MEDIA_ENGINE_HANG: string;
|
|
38
|
+
ICE_SERVER_REJECTED: string;
|
|
39
|
+
CALL_FULL: string;
|
|
40
|
+
ROOM_TOO_LARGE: string;
|
|
41
|
+
GUEST_ALREADY_ADDED: string;
|
|
42
|
+
LOCUS_USER_NOT_AUTHORISED: string;
|
|
43
|
+
CLOUDBERRY_UNAVAILABLE: string;
|
|
44
|
+
ROOM_TOO_LARGE_FREE_ACCOUNT: string;
|
|
45
|
+
MEETING_INACTIVE: string;
|
|
46
|
+
MEETING_LOCKED: string;
|
|
47
|
+
MEETING_TERMINATING: string;
|
|
48
|
+
MODERATOR_PIN_OR_GUEST_REQUIRED: string;
|
|
49
|
+
MODERATOR_PIN_OR_GUEST_PIN_REQUIRED: string;
|
|
50
|
+
MODERATOR_REQUIRED: string;
|
|
51
|
+
USER_NOT_MEMBER_OF_ROOM: string;
|
|
52
|
+
NEW_LOCUS_ERROR: string;
|
|
53
|
+
NETWORK_UNAVAILABLE: string;
|
|
54
|
+
MEETING_UNAVAILABLE: string;
|
|
55
|
+
MEETING_ID_INVALID: string;
|
|
56
|
+
MEETING_SITE_INVALID: string;
|
|
57
|
+
LOCUS_INVALID_JOINTIME: string;
|
|
58
|
+
LOBBY_EXPIRED: string;
|
|
59
|
+
MEDIA_CONNECTION_LOST_PAIRED: string;
|
|
60
|
+
PHONE_NUMBER_NOT_A_NUMBER: string;
|
|
61
|
+
PHONE_NUMBER_TOO_LONG: string;
|
|
62
|
+
INVALID_DIALABLE_KEY: string;
|
|
63
|
+
ONE_ON_ONE_TO_SELF_NOT_ALLOWED: string;
|
|
64
|
+
REMOVED_PARTICIPANT: string;
|
|
65
|
+
MEETING_LINK_NOT_FOUND: string;
|
|
66
|
+
PHONE_NUMBER_TOO_SHORT_AFTER_IDD: string;
|
|
67
|
+
INVALID_INVITEE_ADDRESS: string;
|
|
68
|
+
PMR_USER_ACCOUNT_LOCKED_OUT: string;
|
|
69
|
+
GUEST_FORBIDDEN: string;
|
|
70
|
+
PMR_ACCOUNT_SUSPENDED: string;
|
|
71
|
+
EMPTY_PHONE_NUMBER_OR_COUNTRY_CODE: string;
|
|
72
|
+
CONVERSATION_NOT_FOUND: string;
|
|
73
|
+
SIP_CALLEE_BUSY: string;
|
|
74
|
+
SIP_CALLEE_NOT_FOUND: string;
|
|
75
|
+
START_RECORDING_FAILED: string;
|
|
76
|
+
RECORDING_IN_PROGRESS_FAILED: string;
|
|
77
|
+
MEETING_INFO_LOOKUP_ERROR: string;
|
|
78
|
+
CALL_FULL_ADD_GUEST: string;
|
|
79
|
+
REQUIRE_WEBEX_LOGIN: string;
|
|
80
|
+
USER_NOT_ALLOWED_ACCESS_MEETING: string;
|
|
81
|
+
USER_NEEDS_ACTIVATION: string;
|
|
82
|
+
SIGN_UP_INVALID_EMAIL: string;
|
|
83
|
+
UNKNOWN_ERROR: string;
|
|
84
|
+
NO_MEDIA_FOUND: string;
|
|
85
|
+
STREAM_ERROR_NO_MEDIA: string;
|
|
86
|
+
CAMERA_PERMISSION_DENIED: string;
|
|
87
|
+
FRAUD_DETECTION: string;
|
|
88
|
+
E2EE_NOT_SUPPORTED: string;
|
|
89
|
+
LOCUS_LOBBY_FULL_CMR: string;
|
|
90
|
+
USER_NOT_INVITED_TO_JOIN: string;
|
|
91
|
+
MISSING_ROAP_ANSWER: string;
|
|
92
|
+
DTLS_HANDSHAKE_FAILED: string;
|
|
93
|
+
ICE_FAILED_WITHOUT_TURN_TLS: string;
|
|
94
|
+
ICE_FAILED_WITH_TURN_TLS: string;
|
|
95
|
+
SDP_OFFER_CREATION_ERROR: string;
|
|
96
|
+
SDP_OFFER_CREATION_ERROR_MISSING_CODEC: string;
|
|
97
|
+
};
|
|
98
|
+
export declare const SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP: {
|
|
99
|
+
58400: number;
|
|
100
|
+
99002: number;
|
|
101
|
+
99009: number;
|
|
102
|
+
58500: number;
|
|
103
|
+
400001: number;
|
|
104
|
+
403004: number;
|
|
105
|
+
403028: number;
|
|
106
|
+
403032: number;
|
|
107
|
+
403034: number;
|
|
108
|
+
403036: number;
|
|
109
|
+
403038: number;
|
|
110
|
+
403040: number;
|
|
111
|
+
403041: number;
|
|
112
|
+
403047: number;
|
|
113
|
+
403408: number;
|
|
114
|
+
403043: number;
|
|
115
|
+
403048: number;
|
|
116
|
+
403049: number;
|
|
117
|
+
403100: number;
|
|
118
|
+
403101: number;
|
|
119
|
+
403102: number;
|
|
120
|
+
403103: number;
|
|
121
|
+
403104: number;
|
|
122
|
+
404001: number;
|
|
123
|
+
404006: number;
|
|
124
|
+
423001: number;
|
|
125
|
+
423005: number;
|
|
126
|
+
423006: number;
|
|
127
|
+
423010: number;
|
|
128
|
+
423012: number;
|
|
129
|
+
423013: number;
|
|
130
|
+
429005: number;
|
|
131
|
+
2403001: number;
|
|
132
|
+
2403002: number;
|
|
133
|
+
2403003: number;
|
|
134
|
+
2403004: number;
|
|
135
|
+
2403018: number;
|
|
136
|
+
2403019: number;
|
|
137
|
+
2423003: number;
|
|
138
|
+
2423004: number;
|
|
139
|
+
2423005: number;
|
|
140
|
+
2423006: number;
|
|
141
|
+
2423016: number;
|
|
142
|
+
2423017: number;
|
|
143
|
+
2423018: number;
|
|
144
|
+
2423012: number;
|
|
145
|
+
2423021: number;
|
|
146
|
+
2423007: number;
|
|
147
|
+
2403010: number;
|
|
148
|
+
2403014: number;
|
|
149
|
+
2403015: number;
|
|
150
|
+
2423010: number;
|
|
151
|
+
2400008: number;
|
|
152
|
+
2400011: number;
|
|
153
|
+
2400012: number;
|
|
154
|
+
2403007: number;
|
|
155
|
+
2401002: number;
|
|
156
|
+
2404002: number;
|
|
157
|
+
2400009: number;
|
|
158
|
+
2400025: number;
|
|
159
|
+
2423009: number;
|
|
160
|
+
2403022: number;
|
|
161
|
+
2423008: number;
|
|
162
|
+
2400006: number;
|
|
163
|
+
2400014: number;
|
|
164
|
+
2404001: number;
|
|
165
|
+
2403025: number;
|
|
166
|
+
2405001: number;
|
|
167
|
+
2409005: number;
|
|
168
|
+
2409062: number;
|
|
169
|
+
2423025: number;
|
|
170
|
+
100002: number;
|
|
171
|
+
100007: number;
|
|
172
|
+
100001: number;
|
|
173
|
+
100006: number;
|
|
174
|
+
100005: number;
|
|
175
|
+
100004: number;
|
|
176
|
+
};
|
|
177
|
+
export declare const CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD: Record<number, Partial<ClientEventError>>;
|
|
178
|
+
export declare const CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND = "js_sdk_call_diagnostic_event_failed_to_send";
|
package/dist/types/config.d.ts
CHANGED
|
@@ -12,7 +12,25 @@ declare namespace _default {
|
|
|
12
12
|
const batcherMaxCalls: number;
|
|
13
13
|
const batcherMaxWait: number;
|
|
14
14
|
const batcherRetryPlateau: number;
|
|
15
|
+
const waitForServiceTimeout: number;
|
|
15
16
|
}
|
|
16
17
|
export { metrics_1 as metrics };
|
|
17
18
|
}
|
|
18
19
|
export default _default;
|
|
20
|
+
export namespace OS_NAME {
|
|
21
|
+
const WINDOWS: string;
|
|
22
|
+
const MAC: string;
|
|
23
|
+
const IOS: string;
|
|
24
|
+
const ANDROID: string;
|
|
25
|
+
const CHROME: string;
|
|
26
|
+
const LINUX: string;
|
|
27
|
+
const OTHERS: string;
|
|
28
|
+
}
|
|
29
|
+
export const OSMap: {
|
|
30
|
+
'Chrome OS': string;
|
|
31
|
+
macOS: string;
|
|
32
|
+
Windows: string;
|
|
33
|
+
iOS: string;
|
|
34
|
+
Android: string;
|
|
35
|
+
Linux: string;
|
|
36
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
import '@webex/internal-plugin-device';
|
|
5
|
+
import config from './config';
|
|
6
|
+
import NewMetrics from './new-metrics';
|
|
7
|
+
import * as Utils from './utils';
|
|
8
|
+
import { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitOperationalEvent, SubmitMQE } from './metrics.types';
|
|
9
|
+
import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
|
|
10
|
+
import * as CallDiagnosticUtils from './call-diagnostic/call-diagnostic-metrics.util';
|
|
11
|
+
import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
|
|
12
|
+
import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
|
|
13
|
+
export { default, getOSNameInternal } from './metrics';
|
|
14
|
+
export { config, CALL_DIAGNOSTIC_CONFIG, NewMetrics, Utils, CallDiagnosticUtils, CallDiagnosticLatencies, CallDiagnosticMetrics, };
|
|
15
|
+
export type { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitMQE, SubmitOperationalEvent, };
|
package/dist/types/metrics.d.ts
CHANGED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ClientEvent as RawClientEvent, Event as RawEvent, MediaQualityEvent as RawMediaQualityEvent } from '@webex/event-dictionary-ts';
|
|
2
|
+
export type Event = Omit<RawEvent, 'event'> & {
|
|
3
|
+
event: RawClientEvent | RawMediaQualityEvent;
|
|
4
|
+
};
|
|
5
|
+
export type ClientEventError = NonNullable<RawClientEvent['errors']>[0];
|
|
6
|
+
export type EnvironmentType = NonNullable<RawEvent['origin']['environment']>;
|
|
7
|
+
export type NewEnvironmentType = NonNullable<RawEvent['origin']['newEnvironment']>;
|
|
8
|
+
export type ClientLaunchMethodType = NonNullable<RawEvent['origin']['clientInfo']>['clientLaunchMethod'];
|
|
9
|
+
export type SubmitClientEventOptions = {
|
|
10
|
+
meetingId?: string;
|
|
11
|
+
mediaConnections?: any[];
|
|
12
|
+
rawError?: any;
|
|
13
|
+
correlationId?: string;
|
|
14
|
+
preLoginId?: string;
|
|
15
|
+
environment?: EnvironmentType;
|
|
16
|
+
newEnvironmentType?: NewEnvironmentType;
|
|
17
|
+
clientLaunchMethod?: ClientLaunchMethodType;
|
|
18
|
+
webexConferenceIdStr?: string;
|
|
19
|
+
globalMeetingId?: string;
|
|
20
|
+
};
|
|
21
|
+
export type SubmitMQEOptions = {
|
|
22
|
+
meetingId: string;
|
|
23
|
+
mediaConnections?: any[];
|
|
24
|
+
networkType?: Event['origin']['networkType'];
|
|
25
|
+
webexConferenceIdStr?: string;
|
|
26
|
+
globalMeetingId?: string;
|
|
27
|
+
};
|
|
28
|
+
export type InternalEvent = {
|
|
29
|
+
name: 'internal.client.meetinginfo.request' | 'internal.client.meetinginfo.response' | 'internal.register.device.request' | 'internal.register.device.response' | 'internal.reset.join.latencies' | 'internal.client.meeting.click.joinbutton' | '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';
|
|
30
|
+
payload?: never;
|
|
31
|
+
options?: never;
|
|
32
|
+
};
|
|
33
|
+
export interface ClientEvent {
|
|
34
|
+
name: RawClientEvent['name'];
|
|
35
|
+
payload?: RawClientEvent;
|
|
36
|
+
options?: SubmitClientEventOptions;
|
|
37
|
+
}
|
|
38
|
+
export interface BehavioralEvent {
|
|
39
|
+
name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';
|
|
40
|
+
payload?: never;
|
|
41
|
+
options?: never;
|
|
42
|
+
}
|
|
43
|
+
export interface OperationalEvent {
|
|
44
|
+
name: never;
|
|
45
|
+
payload?: never;
|
|
46
|
+
options?: never;
|
|
47
|
+
}
|
|
48
|
+
export interface FeatureEvent {
|
|
49
|
+
name: never;
|
|
50
|
+
payload?: never;
|
|
51
|
+
options?: never;
|
|
52
|
+
}
|
|
53
|
+
export interface MediaQualityEvent {
|
|
54
|
+
name: RawMediaQualityEvent['name'];
|
|
55
|
+
payload?: RawMediaQualityEvent;
|
|
56
|
+
options: SubmitMQEOptions;
|
|
57
|
+
}
|
|
58
|
+
export type RecursivePartial<T> = {
|
|
59
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
60
|
+
};
|
|
61
|
+
export type MetricEventNames = InternalEvent['name'] | ClientEvent['name'] | BehavioralEvent['name'] | OperationalEvent['name'] | FeatureEvent['name'] | MediaQualityEvent['name'];
|
|
62
|
+
export type ClientInfo = NonNullable<RawEvent['origin']['clientInfo']>;
|
|
63
|
+
export type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];
|
|
64
|
+
export type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];
|
|
65
|
+
export type NetworkType = NonNullable<RawEvent['origin']>['networkType'];
|
|
66
|
+
export type ClientSubServiceType = ClientEvent['payload']['webexSubServiceType'];
|
|
67
|
+
export type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;
|
|
68
|
+
export type ClientEventLeaveReason = ClientEvent['payload']['leaveReason'];
|
|
69
|
+
export type ClientEventPayloadError = ClientEvent['payload']['errors'];
|
|
70
|
+
export type MediaQualityEventAudioSetupDelayPayload = NonNullable<MediaQualityEvent['payload']>['audioSetupDelay'];
|
|
71
|
+
export type MediaQualityEventVideoSetupDelayPayload = NonNullable<MediaQualityEvent['payload']>['videoSetupDelay'];
|
|
72
|
+
export type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {
|
|
73
|
+
intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];
|
|
74
|
+
};
|
|
75
|
+
export type SubmitInternalEvent = (args: {
|
|
76
|
+
name: InternalEvent['name'];
|
|
77
|
+
payload?: RecursivePartial<InternalEvent['payload']>;
|
|
78
|
+
options?: any;
|
|
79
|
+
}) => void;
|
|
80
|
+
export type SubmitBehavioralEvent = (args: {
|
|
81
|
+
name: BehavioralEvent['name'];
|
|
82
|
+
payload?: RecursivePartial<BehavioralEvent['payload']>;
|
|
83
|
+
options?: any;
|
|
84
|
+
}) => void;
|
|
85
|
+
export type SubmitClientEvent = (args: {
|
|
86
|
+
name: ClientEvent['name'];
|
|
87
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
88
|
+
options?: SubmitClientEventOptions;
|
|
89
|
+
}) => Promise<any>;
|
|
90
|
+
export type SubmitOperationalEvent = (args: {
|
|
91
|
+
name: OperationalEvent['name'];
|
|
92
|
+
payload?: RecursivePartial<OperationalEvent['payload']>;
|
|
93
|
+
options?: any;
|
|
94
|
+
}) => void;
|
|
95
|
+
export type SubmitMQE = (args: {
|
|
96
|
+
name: MediaQualityEvent['name'];
|
|
97
|
+
payload: SubmitMQEPayload;
|
|
98
|
+
options: any;
|
|
99
|
+
}) => void;
|
|
100
|
+
export type BuildClientEventFetchRequestOptions = (args: {
|
|
101
|
+
name: ClientEvent['name'];
|
|
102
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
103
|
+
options?: SubmitClientEventOptions;
|
|
104
|
+
}) => Promise<any>;
|
|
105
|
+
export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.click.to.interstitial' | 'internal.call.init.join.req';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { WebexPlugin } from '@webex/webex-core';
|
|
2
|
+
import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
|
|
3
|
+
import { RecursivePartial, ClientEvent, FeatureEvent, BehavioralEvent, OperationalEvent, MediaQualityEvent, InternalEvent, SubmitClientEventOptions } from './metrics.types';
|
|
4
|
+
import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
|
|
5
|
+
/**
|
|
6
|
+
* Metrics plugin to centralize all types of metrics.
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
declare class Metrics extends WebexPlugin {
|
|
10
|
+
static instance: Metrics;
|
|
11
|
+
callDiagnosticLatencies: CallDiagnosticLatencies;
|
|
12
|
+
callDiagnosticMetrics: CallDiagnosticMetrics;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param args
|
|
16
|
+
* @constructor
|
|
17
|
+
* @private
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
constructor(...args: any[]);
|
|
21
|
+
/**
|
|
22
|
+
* On Ready
|
|
23
|
+
*/
|
|
24
|
+
private onReady;
|
|
25
|
+
/**
|
|
26
|
+
* Used for internal purposes only
|
|
27
|
+
* @param args
|
|
28
|
+
*/
|
|
29
|
+
submitInternalEvent({ name, payload, options, }: {
|
|
30
|
+
name: InternalEvent['name'];
|
|
31
|
+
payload?: RecursivePartial<InternalEvent['payload']>;
|
|
32
|
+
options?: any;
|
|
33
|
+
}): void;
|
|
34
|
+
/**
|
|
35
|
+
* Behavioral event
|
|
36
|
+
* @param args
|
|
37
|
+
*/
|
|
38
|
+
submitBehavioralEvent({ name, payload, options, }: {
|
|
39
|
+
name: BehavioralEvent['name'];
|
|
40
|
+
payload?: RecursivePartial<BehavioralEvent['payload']>;
|
|
41
|
+
options?: any;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Operational event
|
|
45
|
+
* @param args
|
|
46
|
+
*/
|
|
47
|
+
submitOperationalEvent({ name, payload, options, }: {
|
|
48
|
+
name: OperationalEvent['name'];
|
|
49
|
+
payload?: RecursivePartial<OperationalEvent['payload']>;
|
|
50
|
+
options?: any;
|
|
51
|
+
}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Call Analyzer: Media Quality Event
|
|
54
|
+
* @param args
|
|
55
|
+
*/
|
|
56
|
+
submitMQE({ name, payload, options, }: {
|
|
57
|
+
name: MediaQualityEvent['name'];
|
|
58
|
+
payload: RecursivePartial<MediaQualityEvent['payload']> & {
|
|
59
|
+
intervals: MediaQualityEvent['payload']['intervals'];
|
|
60
|
+
};
|
|
61
|
+
options: any;
|
|
62
|
+
}): void;
|
|
63
|
+
/**
|
|
64
|
+
* Call Analyzer: Feature Usage Event
|
|
65
|
+
* @param args
|
|
66
|
+
*/
|
|
67
|
+
submitFeatureEvent({ name, payload, options, }: {
|
|
68
|
+
name: FeatureEvent['name'];
|
|
69
|
+
payload?: RecursivePartial<FeatureEvent['payload']>;
|
|
70
|
+
options: any;
|
|
71
|
+
}): void;
|
|
72
|
+
/**
|
|
73
|
+
* Call Analyzer: Client Event
|
|
74
|
+
* @public
|
|
75
|
+
* @param args
|
|
76
|
+
*/
|
|
77
|
+
submitClientEvent({ name, payload, options, }: {
|
|
78
|
+
name: ClientEvent['name'];
|
|
79
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
80
|
+
options?: SubmitClientEventOptions;
|
|
81
|
+
}): Promise<any>;
|
|
82
|
+
/**
|
|
83
|
+
* Issue request to alias a user's pre-login ID with their CI UUID
|
|
84
|
+
* @param {string} preLoginId
|
|
85
|
+
* @returns {Object} HttpResponse object
|
|
86
|
+
*/
|
|
87
|
+
clientMetricsAliasUser(preLoginId: string): any;
|
|
88
|
+
/**
|
|
89
|
+
* Returns a promise that will resolve to fetch options for submitting a metric.
|
|
90
|
+
*
|
|
91
|
+
* This is to support quickly submitting metrics when the browser/tab is closing.
|
|
92
|
+
* Calling submitClientEvent will not work because there some async steps that will
|
|
93
|
+
* not complete before the browser is closed. Instead, we pre-gather all the
|
|
94
|
+
* information/options needed for the request(s), and then simply and quickly
|
|
95
|
+
* fire the fetch(es) when beforeUnload is triggered.
|
|
96
|
+
*
|
|
97
|
+
* We must use fetch instead of request because fetch has a keepalive option that
|
|
98
|
+
* allows the request it to outlive the page.
|
|
99
|
+
*
|
|
100
|
+
* Note: the timings values will be wrong, but setMetricTimingsAndFetch() will
|
|
101
|
+
* properly adjust them before submitting.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
* @param {Object} arg
|
|
105
|
+
* @param {String} arg.name - event name
|
|
106
|
+
* @param {Object} arg.payload - event payload
|
|
107
|
+
* @param {Object} arg.options - other options
|
|
108
|
+
* @returns {Promise} promise that resolves to options to be used with fetch
|
|
109
|
+
*/
|
|
110
|
+
buildClientEventFetchRequestOptions({ name, payload, options, }: {
|
|
111
|
+
name: ClientEvent['name'];
|
|
112
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
113
|
+
options?: SubmitClientEventOptions;
|
|
114
|
+
}): Promise<any>;
|
|
115
|
+
/**
|
|
116
|
+
* Submits a metric from pre-built request options via the fetch API. Updates
|
|
117
|
+
* the "$timings" and "originTime" values to Date.now() since the existing times
|
|
118
|
+
* were set when the options were built (not submitted).
|
|
119
|
+
|
|
120
|
+
* @param {any} options - the pre-built request options for submitting a metric
|
|
121
|
+
* @returns {Promise} promise that resolves to the response object
|
|
122
|
+
*/
|
|
123
|
+
setMetricTimingsAndFetch(options: any): Promise<any>;
|
|
124
|
+
/**
|
|
125
|
+
* Returns true if the specified serviceErrorCode maps to an expected error.
|
|
126
|
+
* @param {number} serviceErrorCode the service error code
|
|
127
|
+
* @returns {boolean}
|
|
128
|
+
*/
|
|
129
|
+
isServiceErrorExpected(serviceErrorCode: number): boolean;
|
|
130
|
+
}
|
|
131
|
+
export default Metrics;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.generateCommonErrorMetadata = void 0;
|
|
9
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
10
|
+
/* eslint-disable import/prefer-default-export */
|
|
11
|
+
/**
|
|
12
|
+
* Generates common metadata for errors
|
|
13
|
+
* @param {any} error
|
|
14
|
+
* @returns {object}
|
|
15
|
+
*/
|
|
16
|
+
var generateCommonErrorMetadata = exports.generateCommonErrorMetadata = function generateCommonErrorMetadata(error) {
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
return (0, _stringify.default)({
|
|
19
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
20
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
21
|
+
stack: error === null || error === void 0 ? void 0 : error.stack
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return error;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateCommonErrorMetadata","exports","error","Error","_stringify","default","message","name","stack"],"sources":["utils.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n/**\n * Generates common metadata for errors\n * @param {any} error\n * @returns {object}\n */\nexport const generateCommonErrorMetadata = (error) => {\n if (error instanceof Error) {\n return JSON.stringify({\n message: error?.message,\n name: error?.name,\n stack: error?.stack,\n });\n }\n\n return error;\n};\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,SAA9BA,2BAA2BA,CAAIE,KAAK,EAAK;EACpD,IAAIA,KAAK,YAAYC,KAAK,EAAE;IAC1B,OAAO,IAAAC,UAAA,CAAAC,OAAA,EAAe;MACpBC,OAAO,EAAEJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEI,OAAO;MACvBC,IAAI,EAAEL,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEK,IAAI;MACjBC,KAAK,EAAEN,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEM;IAChB,CAAC,CAAC;EACJ;EAEA,OAAON,KAAK;AACd,CAAC"}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-metrics",
|
|
3
|
-
"version": "3.0.0-bnr.4",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
6
|
"devMain": "src/index.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/webex/webex-js-sdk.git",
|
|
@@ -20,16 +20,40 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@babel/core": "^7.17.10",
|
|
23
24
|
"@sinonjs/fake-timers": "^6.0.1",
|
|
25
|
+
"@webex/babel-config-legacy": "0.0.0",
|
|
26
|
+
"@webex/eslint-config-legacy": "0.0.0",
|
|
27
|
+
"@webex/jest-config-legacy": "0.0.0",
|
|
28
|
+
"@webex/legacy-tools": "0.0.0",
|
|
29
|
+
"@webex/test-helper-chai": "3.0.0",
|
|
30
|
+
"@webex/test-helper-mocha": "3.0.0",
|
|
31
|
+
"@webex/test-helper-mock-webex": "3.0.0",
|
|
32
|
+
"@webex/test-helper-test-users": "3.0.0",
|
|
33
|
+
"eslint": "^8.24.0",
|
|
34
|
+
"prettier": "^2.7.1",
|
|
24
35
|
"sinon": "^9.2.4"
|
|
25
36
|
},
|
|
26
37
|
"dependencies": {
|
|
27
|
-
"@webex/common": "
|
|
28
|
-
"@webex/common-timers": "
|
|
29
|
-
"@webex/
|
|
30
|
-
"@webex/internal-plugin-
|
|
31
|
-
"@webex/
|
|
32
|
-
"@webex/test-helper-
|
|
33
|
-
"@webex/webex
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
"@webex/common": "3.0.0",
|
|
39
|
+
"@webex/common-timers": "3.0.0",
|
|
40
|
+
"@webex/event-dictionary-ts": "^1.0.1329",
|
|
41
|
+
"@webex/internal-plugin-device": "3.0.0",
|
|
42
|
+
"@webex/internal-plugin-metrics": "3.0.0",
|
|
43
|
+
"@webex/test-helper-chai": "3.0.0",
|
|
44
|
+
"@webex/test-helper-mock-webex": "3.0.0",
|
|
45
|
+
"@webex/webex-core": "3.0.0",
|
|
46
|
+
"ip-anonymize": "^0.1.0",
|
|
47
|
+
"lodash": "^4.17.21",
|
|
48
|
+
"uuid": "^3.3.2"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": " yarn run -T tsc --declaration true --declarationDir ./dist/types",
|
|
52
|
+
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps && yarn build",
|
|
53
|
+
"deploy:npm": "yarn npm publish",
|
|
54
|
+
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
55
|
+
"test:style": "eslint ./src/**/*.*",
|
|
56
|
+
"test:unit": "webex-legacy-tools test --unit --runner mocha"
|
|
57
|
+
},
|
|
58
|
+
"version": "3.0.0"
|
|
59
|
+
}
|
package/process
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {browser: true};
|
package/src/batcher.js
CHANGED
|
@@ -7,9 +7,18 @@ import {safeSetTimeout} from '@webex/common-timers';
|
|
|
7
7
|
|
|
8
8
|
const sym = Symbol('metric id');
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @class
|
|
12
|
+
* @extends Batcher
|
|
13
|
+
* @memberof Metrics
|
|
14
|
+
*/
|
|
10
15
|
const MetricsBatcher = Batcher.extend({
|
|
11
16
|
namespace: 'Metrics',
|
|
12
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @param {any} item
|
|
20
|
+
* @returns {Promise<any>}
|
|
21
|
+
*/
|
|
13
22
|
prepareItem(item) {
|
|
14
23
|
// Keep non-prod data out of metrics
|
|
15
24
|
const env = process.env.NODE_ENV === 'production' ? null : 'TEST';
|
|
@@ -22,6 +31,10 @@ const MetricsBatcher = Batcher.extend({
|
|
|
22
31
|
return Promise.resolve(item);
|
|
23
32
|
},
|
|
24
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @param {any[]} queue
|
|
36
|
+
* @returns {Promise<any[]>}
|
|
37
|
+
*/
|
|
25
38
|
prepareRequest(queue) {
|
|
26
39
|
return Promise.resolve(
|
|
27
40
|
queue.map((item) => {
|
|
@@ -32,6 +45,10 @@ const MetricsBatcher = Batcher.extend({
|
|
|
32
45
|
);
|
|
33
46
|
},
|
|
34
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {any} payload
|
|
50
|
+
* @returns {Promise<any>}
|
|
51
|
+
*/
|
|
35
52
|
submitHttpRequest(payload) {
|
|
36
53
|
return this.webex.request({
|
|
37
54
|
method: 'POST',
|
|
@@ -40,13 +57,22 @@ const MetricsBatcher = Batcher.extend({
|
|
|
40
57
|
body: {
|
|
41
58
|
metrics: payload,
|
|
42
59
|
},
|
|
60
|
+
waitForServiceTimeout: this.webex.config.metrics.waitForServiceTimeout,
|
|
43
61
|
});
|
|
44
62
|
},
|
|
45
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @param {any} res
|
|
66
|
+
* @returns {Promise<any>}
|
|
67
|
+
*/
|
|
46
68
|
handleHttpSuccess(res) {
|
|
47
69
|
return Promise.all(res.options.body.metrics.map((item) => this.acceptItem(item)));
|
|
48
70
|
},
|
|
49
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @param {any} reason
|
|
74
|
+
* @returns {Promise<any>}
|
|
75
|
+
*/
|
|
50
76
|
handleHttpError(reason) {
|
|
51
77
|
if (reason instanceof WebexHttpError.NetworkOrCORSError) {
|
|
52
78
|
this.logger.warn(
|
|
@@ -73,6 +99,10 @@ const MetricsBatcher = Batcher.extend({
|
|
|
73
99
|
return Reflect.apply(Batcher.prototype.handleHttpError, this, [reason]);
|
|
74
100
|
},
|
|
75
101
|
|
|
102
|
+
/**
|
|
103
|
+
* @param {any} item
|
|
104
|
+
* @returns {Promise<any>}
|
|
105
|
+
*/
|
|
76
106
|
rerequest(item) {
|
|
77
107
|
return Promise.all([this.getDeferredForRequest(item), this.prepareItem(item)]).then(
|
|
78
108
|
([defer, req]) => {
|
|
@@ -83,6 +113,10 @@ const MetricsBatcher = Batcher.extend({
|
|
|
83
113
|
);
|
|
84
114
|
},
|
|
85
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @param {any} item
|
|
118
|
+
* @returns {Promise<any>}
|
|
119
|
+
*/
|
|
86
120
|
fingerprintRequest(item) {
|
|
87
121
|
item[sym] = item[sym] || {
|
|
88
122
|
nextDelay: 1000,
|
|
@@ -91,6 +125,10 @@ const MetricsBatcher = Batcher.extend({
|
|
|
91
125
|
return Promise.resolve(item[sym]);
|
|
92
126
|
},
|
|
93
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @param {any} item
|
|
130
|
+
* @returns {Promise<any>}
|
|
131
|
+
*/
|
|
94
132
|
fingerprintResponse(item) {
|
|
95
133
|
return Promise.resolve(item[sym]);
|
|
96
134
|
},
|