@webex/internal-plugin-metrics 3.5.0-next.2 → 3.5.0-next.21

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.
Files changed (41) hide show
  1. package/dist/business-metrics.js +119 -9
  2. package/dist/business-metrics.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +1 -1
  4. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +18 -9
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  7. package/dist/call-diagnostic/config.js +13 -3
  8. package/dist/call-diagnostic/config.js.map +1 -1
  9. package/dist/index.js +7 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/metrics.js +1 -1
  12. package/dist/metrics.types.js.map +1 -1
  13. package/dist/new-metrics.js +5 -2
  14. package/dist/new-metrics.js.map +1 -1
  15. package/dist/rtcMetrics/constants.js +11 -0
  16. package/dist/rtcMetrics/constants.js.map +1 -0
  17. package/dist/rtcMetrics/index.js +223 -0
  18. package/dist/rtcMetrics/index.js.map +1 -0
  19. package/dist/types/business-metrics.d.ts +36 -4
  20. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +6 -1
  21. package/dist/types/call-diagnostic/config.d.ts +3 -0
  22. package/dist/types/index.d.ts +2 -1
  23. package/dist/types/metrics.types.d.ts +17 -2
  24. package/dist/types/new-metrics.d.ts +5 -3
  25. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  26. package/dist/types/rtcMetrics/index.d.ts +80 -0
  27. package/package.json +11 -11
  28. package/src/business-metrics.ts +97 -5
  29. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +1 -1
  30. package/src/call-diagnostic/call-diagnostic-metrics.ts +17 -9
  31. package/src/call-diagnostic/config.ts +12 -0
  32. package/src/index.ts +2 -0
  33. package/src/metrics.types.ts +95 -23
  34. package/src/new-metrics.ts +12 -2
  35. package/src/rtcMetrics/constants.ts +3 -0
  36. package/src/rtcMetrics/index.ts +205 -0
  37. package/test/unit/spec/business/business-metrics.ts +69 -2
  38. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +4 -6
  39. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +274 -33
  40. package/test/unit/spec/new-metrics.ts +18 -3
  41. package/test/unit/spec/rtcMetrics/index.ts +196 -0
@@ -8,8 +8,8 @@ export type NewEnvironmentType = NonNullable<RawEvent['origin']['newEnvironment'
8
8
  export type ClientLaunchMethodType = NonNullable<RawEvent['origin']['clientInfo']>['clientLaunchMethod'];
9
9
  export type BrowserLaunchMethodType = NonNullable<RawEvent['origin']['clientInfo']>['browserLaunchMethod'];
10
10
  export type MetricEventProduct = 'webex' | 'wxcc_desktop';
11
- export type MetricEventAgent = 'user' | 'browser' | 'system' | 'sdk' | 'redux' | 'service';
12
- export type MetricEventVerb = 'create' | 'get' | 'fetch' | 'update' | 'list' | 'delete' | 'select' | 'view' | 'set' | 'toggle' | 'load' | 'reload' | 'click' | 'hover' | 'register' | 'unregister' | 'enable' | 'disable' | 'use' | 'complete' | 'submit' | 'apply' | 'cancel' | 'abort' | 'sync' | 'login' | 'logout' | 'answer' | 'activate' | 'deactivate';
11
+ export type MetricEventAgent = 'user' | 'browser' | 'system' | 'sdk' | 'redux' | 'service' | 'api';
12
+ export type MetricEventVerb = 'abort' | 'accept' | 'activate' | 'apply' | 'answer' | 'authorize' | 'build' | 'cancel' | 'change' | 'click' | 'close' | 'complete' | 'connect' | 'create' | 'deactivate' | 'decrypt' | 'delete' | 'deliver' | 'destroy' | 'disable' | 'disconnect' | 'dismiss' | 'display' | 'download' | 'edit' | 'enable' | 'encrypt' | 'end' | 'expire' | 'fail' | 'fetch' | 'fire' | 'generate' | 'get' | 'hide' | 'hover' | 'ignore' | 'initialize' | 'initiate' | 'invalidate' | 'join' | 'list' | 'load' | 'login' | 'logout' | 'notify' | 'offer' | 'open' | 'press' | 'receive' | 'refer' | 'refresh' | 'register' | 'release' | 'reload' | 'reject' | 'request' | 'reset' | 'resize' | 'respond' | 'retry' | 'revoke' | 'save' | 'search' | 'select' | 'send' | 'set' | 'sign' | 'start' | 'submit' | 'switch' | 'sync' | 'toggle' | 'transfer' | 'unregister' | 'update' | 'upload' | 'use' | 'validate' | 'view' | 'visit' | 'wait' | 'warn' | 'exit';
13
13
  export type SubmitClientEventOptions = {
14
14
  meetingId?: string;
15
15
  mediaConnections?: any[];
@@ -55,6 +55,7 @@ export interface DeviceContext {
55
55
  };
56
56
  }
57
57
  export type MetricType = 'behavioral' | 'operational' | 'business';
58
+ export type Table = 'wbxapp_callend_metrics' | 'business_metrics' | 'business_ucf' | 'default';
58
59
  type InternalEventPayload = string | number | boolean;
59
60
  export type EventPayload = Record<string, InternalEventPayload>;
60
61
  export type BehavioralEventPayload = EventPayload;
@@ -137,4 +138,18 @@ export type BuildClientEventFetchRequestOptions = (args: {
137
138
  options?: SubmitClientEventOptions;
138
139
  }) => Promise<any>;
139
140
  export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.get.cluster.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' | 'internal.api.fetch.intelligence.models';
141
+ export interface IdType {
142
+ meetingId?: string;
143
+ callId?: string;
144
+ }
145
+ export interface IMetricsAttributes {
146
+ type: string;
147
+ version: string;
148
+ userId: string;
149
+ correlationId: string;
150
+ connectionId: string;
151
+ data: any[];
152
+ meetingId?: string;
153
+ callId?: string;
154
+ }
140
155
  export {};
@@ -3,10 +3,11 @@ import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
3
3
  import BehavioralMetrics from './behavioral-metrics';
4
4
  import OperationalMetrics from './operational-metrics';
5
5
  import BusinessMetrics from './business-metrics';
6
- import { RecursivePartial, MetricEventProduct, MetricEventAgent, MetricEventVerb, ClientEvent, FeatureEvent, EventPayload, MediaQualityEvent, InternalEvent, SubmitClientEventOptions } from './metrics.types';
6
+ import { RecursivePartial, MetricEventProduct, MetricEventAgent, MetricEventVerb, ClientEvent, FeatureEvent, EventPayload, MediaQualityEvent, InternalEvent, SubmitClientEventOptions, Table } from './metrics.types';
7
7
  import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
8
8
  /**
9
9
  * Metrics plugin to centralize all types of metrics.
10
+ * https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?pageId=231011379
10
11
  * @class
11
12
  */
12
13
  declare class Metrics extends WebexPlugin {
@@ -85,10 +86,11 @@ declare class Metrics extends WebexPlugin {
85
86
  * Buisness event
86
87
  * @param args
87
88
  */
88
- submitBusinessEvent({ name, payload }: {
89
+ submitBusinessEvent({ name, payload, table, }: {
89
90
  name: string;
90
91
  payload: EventPayload;
91
- }): void | Promise<void>;
92
+ table?: Table;
93
+ }): Promise<void>;
92
94
  /**
93
95
  * Call Analyzer: Media Quality Event
94
96
  * @param args
@@ -0,0 +1,4 @@
1
+ declare const RTC_METRICS: {
2
+ APP_ID: string;
3
+ };
4
+ export { RTC_METRICS as default };
@@ -0,0 +1,80 @@
1
+ import { IdType } from '../metrics.types';
2
+ /**
3
+ * Rtc Metrics
4
+ */
5
+ export default class RtcMetrics {
6
+ /**
7
+ * Array of MetricData items to be sent to the metrics service.
8
+ */
9
+ metricsQueue: any[];
10
+ intervalId: number;
11
+ webex: any;
12
+ meetingId?: string;
13
+ callId?: string;
14
+ correlationId: string;
15
+ connectionId: string;
16
+ shouldSendMetricsOnNextStatsReport: boolean;
17
+ /**
18
+ * Initialize the interval.
19
+ *
20
+ * @param {object} webex - The main `webex` object.
21
+ * @param {IdType} Ids - Meeting or Calling id.
22
+ * @param {string} correlationId - The correlation id.
23
+ */
24
+ constructor(webex: any, { meetingId, callId }: IdType, correlationId: any);
25
+ /**
26
+ * Updates the call identifier with the provided value.
27
+ *
28
+ * @param {string} callId - The new call identifier to set.
29
+ * @returns {void}
30
+ */
31
+ updateCallId(callId: string): void;
32
+ /**
33
+ * Check to see if the metrics queue has any items.
34
+ *
35
+ * @returns {void}
36
+ */
37
+ sendMetricsInQueue(): void;
38
+ /**
39
+ * Forces sending metrics when we get the next stats-report
40
+ *
41
+ * This is useful for cases when something important happens that affects the media connection,
42
+ * for example when we move from lobby into the meeting.
43
+ *
44
+ * @returns {void}
45
+ */
46
+ sendNextMetrics(): void;
47
+ /**
48
+ * Add metrics items to the metrics queue.
49
+ *
50
+ * @param {object} data - An object with a payload array of metrics items.
51
+ *
52
+ * @returns {void}
53
+ */
54
+ addMetrics(data: any): void;
55
+ /**
56
+ * Clear the metrics interval.
57
+ *
58
+ * @returns {void}
59
+ */
60
+ closeMetrics(): void;
61
+ /**
62
+ * Anonymize IP addresses.
63
+ *
64
+ * @param {array} stats - An RTCStatsReport organized into an array of strings.
65
+ * @returns {string}
66
+ */
67
+ anonymizeIp(stats: string): string;
68
+ /**
69
+ * Set a new connection id.
70
+ *
71
+ * @returns {void}
72
+ */
73
+ private resetConnection;
74
+ /**
75
+ * Send metrics to the metrics service.
76
+ *
77
+ * @returns {void}
78
+ */
79
+ private sendMetrics;
80
+ }
package/package.json CHANGED
@@ -26,22 +26,22 @@
26
26
  "@webex/eslint-config-legacy": "0.0.0",
27
27
  "@webex/jest-config-legacy": "0.0.0",
28
28
  "@webex/legacy-tools": "0.0.0",
29
- "@webex/test-helper-chai": "3.5.0-next.2",
30
- "@webex/test-helper-mocha": "3.5.0-next.2",
31
- "@webex/test-helper-mock-webex": "3.5.0-next.2",
32
- "@webex/test-helper-test-users": "3.5.0-next.2",
29
+ "@webex/test-helper-chai": "3.5.0-next.21",
30
+ "@webex/test-helper-mocha": "3.5.0-next.21",
31
+ "@webex/test-helper-mock-webex": "3.5.0-next.21",
32
+ "@webex/test-helper-test-users": "3.5.0-next.21",
33
33
  "eslint": "^8.24.0",
34
34
  "prettier": "^2.7.1",
35
35
  "sinon": "^9.2.4"
36
36
  },
37
37
  "dependencies": {
38
- "@webex/common": "3.5.0-next.2",
39
- "@webex/common-timers": "3.5.0-next.2",
38
+ "@webex/common": "3.5.0-next.21",
39
+ "@webex/common-timers": "3.5.0-next.21",
40
40
  "@webex/event-dictionary-ts": "^1.0.1546",
41
- "@webex/internal-plugin-metrics": "3.5.0-next.2",
42
- "@webex/test-helper-chai": "3.5.0-next.2",
43
- "@webex/test-helper-mock-webex": "3.5.0-next.2",
44
- "@webex/webex-core": "3.5.0-next.2",
41
+ "@webex/internal-plugin-metrics": "3.5.0-next.21",
42
+ "@webex/test-helper-chai": "3.5.0-next.21",
43
+ "@webex/test-helper-mock-webex": "3.5.0-next.21",
44
+ "@webex/webex-core": "3.5.0-next.21",
45
45
  "ip-anonymize": "^0.1.0",
46
46
  "lodash": "^4.17.21",
47
47
  "uuid": "^3.3.2"
@@ -54,5 +54,5 @@
54
54
  "test:style": "eslint ./src/**/*.*",
55
55
  "test:unit": "webex-legacy-tools test --unit --runner mocha"
56
56
  },
57
- "version": "3.5.0-next.2"
57
+ "version": "3.5.0-next.21"
58
58
  }
@@ -1,5 +1,5 @@
1
1
  import GenericMetrics from './generic-metrics';
2
- import {EventPayload} from './metrics.types';
2
+ import {EventPayload, Table} from './metrics.types';
3
3
 
4
4
  /**
5
5
  * @description Util class to handle Buisness Metrics
@@ -8,23 +8,115 @@ import {EventPayload} from './metrics.types';
8
8
  */
9
9
  export default class BusinessMetrics extends GenericMetrics {
10
10
  /**
11
- * Submit a buisness metric to our metrics endpoint.
11
+ * unfortunately, the pinot team does not allow changes to the schema of wbxapp_callend_metrics
12
+ * so we have to shim this layer specifically for this
13
+ * https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Table+wbxapp_callend_metrics
14
+ * @param {EventPayload} payload payload of the metric
15
+ * @returns {Promise<any>}
16
+ */
17
+ private submitCallEndEvent({payload}: {payload: EventPayload}) {
18
+ const event = {
19
+ type: ['business'],
20
+ eventPayload: {
21
+ key: 'callEnd',
22
+ client_timestamp: new Date().toISOString(),
23
+ appType: 'Web Client',
24
+ value: {
25
+ ...payload,
26
+ },
27
+ },
28
+ };
29
+
30
+ return this.submitEvent({
31
+ kind: 'buisness-events:wbxapp_callend_metrics -> ',
32
+ name: 'wbxapp_callend_metrics',
33
+ event,
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Submit a buisness metric to our metrics endpoint, going to the default business_ucf table
39
+ * all event payload keys are converted into a hex string value
40
+ * unfortunately, the pinot team does not allow changes to the schema of business_metrics
41
+ * so we have to shim this layer specifically for this
42
+ * https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Table%3A+business_metrics
43
+ * @param {string} name of the metric
44
+ * @param {EventPayload} payload payload of the metric
45
+ * @returns {Promise<any>}
46
+ */
47
+ private submitBusinessMetricsEvent({name, payload}: {name: string; payload: EventPayload}) {
48
+ const event = {
49
+ type: ['business'],
50
+ eventPayload: {
51
+ key: name,
52
+ client_timestamp: new Date().toISOString(),
53
+ appType: 'Web Client',
54
+ value: {
55
+ ...this.getContext(),
56
+ ...this.getBrowserDetails(),
57
+ ...payload,
58
+ },
59
+ },
60
+ };
61
+
62
+ return this.submitEvent({kind: 'buisness-events:business_metrics -> ', name, event});
63
+ }
64
+
65
+ /**
66
+ * Submit a buisness metric to our metrics endpoint, going to the default business_ucf table
67
+ * all event payload keys are converted into a hex string value
68
+ * https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA
12
69
  * @param {string} name of the metric
13
70
  * @param {EventPayload} user payload of the metric
14
71
  * @returns {Promise<any>}
15
72
  */
16
- public submitBusinessEvent({name, payload}: {name: string; payload: EventPayload}) {
73
+ private submitDefaultEvent({name, payload}: {name: string; payload: EventPayload}) {
17
74
  const event = {
18
75
  type: ['business'],
19
76
  eventPayload: {
20
77
  key: name,
21
- client_timestamp: Date.now(),
78
+ appType: 'Web Client',
79
+ client_timestamp: new Date().toISOString(),
22
80
  context: this.getContext(),
23
81
  browserDetails: this.getBrowserDetails(),
24
82
  value: payload,
25
83
  },
26
84
  };
27
85
 
28
- this.submitEvent({kind: 'buisness-events -> ', name, event});
86
+ return this.submitEvent({kind: 'buisness-events:default -> ', name, event});
87
+ }
88
+
89
+ /**
90
+ * Submit a buisness metric to our metrics endpoint.
91
+ * routes to the correct table with the correct schema payload by table
92
+ * https://confluence-eng-gpk2.cisco.com/conf/display/WAP/Business+metrics++-%3E+ROMA
93
+ * @param {string} name of the metric, ignored if going to wbxapp_callend_metrics
94
+ * @param {EventPayload} payload user payload of the metric
95
+ * @param {Table} table optional - to submit the metric to and adapt the sent schema
96
+ * @returns {Promise<any>}
97
+ */
98
+ public submitBusinessEvent({
99
+ name,
100
+ payload,
101
+ table,
102
+ }: {
103
+ name: string;
104
+ payload: EventPayload;
105
+ table?: Table;
106
+ }): Promise<void> {
107
+ if (!table) {
108
+ table = 'default';
109
+ }
110
+ switch (table) {
111
+ case 'wbxapp_callend_metrics':
112
+ return this.submitCallEndEvent({payload});
113
+ case 'business_metrics':
114
+ return this.submitBusinessMetricsEvent({name, payload});
115
+ case 'business_ucf':
116
+ return this.submitDefaultEvent({name, payload});
117
+ case 'default':
118
+ default:
119
+ return this.submitDefaultEvent({name, payload});
120
+ }
29
121
  }
30
122
  }
@@ -49,7 +49,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
49
49
  private getMeeting() {
50
50
  if (this.meetingId) {
51
51
  // @ts-ignore
52
- return this.webex.meetings.meetingCollection.get(this.meetingId);
52
+ return this.webex.meetings.getBasicMeetingInformation(this.meetingId);
53
53
  }
54
54
 
55
55
  return undefined;
@@ -139,7 +139,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
139
139
  getIsConvergedArchitectureEnabled({meetingId}: {meetingId?: string}): boolean {
140
140
  if (meetingId) {
141
141
  // @ts-ignore
142
- const meeting = this.webex.meetings.meetingCollection.get(meetingId);
142
+ const meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
143
143
 
144
144
  return meeting?.meetingInfo?.enableConvergedArchitecture;
145
145
  }
@@ -245,7 +245,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
245
245
 
246
246
  if (meetingId) {
247
247
  // @ts-ignore
248
- const meeting = this.webex.meetings.meetingCollection.get(meetingId);
248
+ const meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
249
249
  if (meeting?.environment) {
250
250
  origin.environment = meeting.environment;
251
251
  }
@@ -289,13 +289,18 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
289
289
  sessionCorrelationId,
290
290
  } = options;
291
291
  const identifiers: Event['event']['identifiers'] = {
292
- correlationId: 'unknown',
293
- sessionCorrelationId: 'unknown',
292
+ correlationId: 'unknown', // concerned with setting this to unknown. This will fail diagnostic events parsing because it's not a uuid pattern
294
293
  };
295
294
 
296
295
  if (meeting) {
297
296
  identifiers.correlationId = meeting.correlationId;
298
- identifiers.sessionCorrelationId = meeting.sessionCorrelationId;
297
+ if (meeting.sessionCorrelationId) {
298
+ identifiers.sessionCorrelationId = meeting.sessionCorrelationId;
299
+ }
300
+ }
301
+
302
+ if (sessionCorrelationId) {
303
+ identifiers.sessionCorrelationId = sessionCorrelationId;
299
304
  }
300
305
 
301
306
  if (sessionCorrelationId) {
@@ -306,6 +311,8 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
306
311
  identifiers.correlationId = correlationId;
307
312
  }
308
313
 
314
+ // TODO: should we use patterns.uuid to validate correlationId and session correlation id? they will fail the diagnostic events validation pipeline if improperly formatted
315
+
309
316
  if (this.device) {
310
317
  const {device} = this;
311
318
  const {installationId} = device?.config || {};
@@ -427,7 +434,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
427
434
  // events that will most likely happen in join phase
428
435
  if (meetingId) {
429
436
  // @ts-ignore
430
- const meeting = this.webex.meetings.meetingCollection.get(meetingId);
437
+ const meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
431
438
 
432
439
  if (!meeting) {
433
440
  console.warn(
@@ -628,10 +635,11 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
628
635
  });
629
636
  }
630
637
 
631
- // otherwise return unkown error
638
+ // otherwise return unkown error but passing serviceErrorCode and serviceErrorName so that we know the issue
632
639
  return this.getErrorPayloadForClientErrorCode({
633
640
  clientErrorCode: UNKNOWN_ERROR,
634
- serviceErrorCode: UNKNOWN_ERROR,
641
+ serviceErrorCode: serviceErrorCode || UNKNOWN_ERROR,
642
+ serviceErrorName: rawError?.name,
635
643
  payloadOverrides: rawError.payloadOverrides,
636
644
  rawErrorMessage,
637
645
  httpStatusCode,
@@ -663,7 +671,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
663
671
  } = options;
664
672
 
665
673
  // @ts-ignore
666
- const meeting = this.webex.meetings.meetingCollection.get(meetingId);
674
+ const meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
667
675
 
668
676
  if (!meeting) {
669
677
  console.warn(
@@ -129,6 +129,7 @@ export const ERROR_DESCRIPTIONS = {
129
129
  ICE_AND_REACHABILITY_FAILED: 'ICEAndReachabilityFailed',
130
130
  SDP_OFFER_CREATION_ERROR: 'SdpOfferCreationError',
131
131
  SDP_OFFER_CREATION_ERROR_MISSING_CODEC: 'SdpOfferCreationErrorMissingCodec',
132
+ WDM_RESTRICTED_REGION: 'WdmRestrictedRegion',
132
133
  };
133
134
 
134
135
  export const SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP = {
@@ -288,6 +289,12 @@ export const SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP = {
288
289
  100005: 4103, // Depracated because of an issue in the UCF Clients
289
290
  // If both email-hash and domain-hash are null or undefined.
290
291
  100004: 4103,
292
+
293
+ // ---- WDM ----
294
+ // WDM_BLOCKED_ACCESS_BY_COUNTRY_CODE_BANNED_COUNTRY_ERROR_CODE
295
+ 4404002: 13000,
296
+ // WDM_BLOCKED_ACCESS_BY_COUNTRY_CODE_RESTRICTED_COUNTRY_ERROR_CODE
297
+ 4404003: 13000,
291
298
  };
292
299
 
293
300
  export const CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD: Record<number, Partial<ClientEventError>> = {
@@ -687,6 +694,11 @@ export const CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD: Record<number, Partial<ClientEv
687
694
  category: 'expected',
688
695
  fatal: true,
689
696
  },
697
+ 13000: {
698
+ errorDescription: ERROR_DESCRIPTIONS.WDM_RESTRICTED_REGION,
699
+ category: 'expected',
700
+ fatal: true,
701
+ },
690
702
  };
691
703
 
692
704
  export const CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND = 'js_sdk_call_diagnostic_event_failed_to_send';
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-l
25
25
  import BehavioralMetrics from './behavioral-metrics';
26
26
  import OperationalMetrics from './operational-metrics';
27
27
  import BusinessMetrics from './business-metrics';
28
+ import RtcMetrics from './rtcMetrics';
28
29
 
29
30
  registerInternalPlugin('metrics', Metrics, {
30
31
  config,
@@ -47,6 +48,7 @@ export {
47
48
  BehavioralMetrics,
48
49
  OperationalMetrics,
49
50
  BusinessMetrics,
51
+ RtcMetrics,
50
52
  };
51
53
  export type {
52
54
  ClientEvent,
@@ -22,39 +22,93 @@ export type BrowserLaunchMethodType = NonNullable<
22
22
 
23
23
  export type MetricEventProduct = 'webex' | 'wxcc_desktop';
24
24
 
25
- export type MetricEventAgent = 'user' | 'browser' | 'system' | 'sdk' | 'redux' | 'service';
25
+ export type MetricEventAgent = 'user' | 'browser' | 'system' | 'sdk' | 'redux' | 'service' | 'api';
26
26
 
27
27
  export type MetricEventVerb =
28
+ | 'abort'
29
+ | 'accept'
30
+ | 'activate'
31
+ | 'apply'
32
+ | 'answer'
33
+ | 'authorize'
34
+ | 'build'
35
+ | 'cancel'
36
+ | 'change'
37
+ | 'click'
38
+ | 'close'
39
+ | 'complete'
40
+ | 'connect'
28
41
  | 'create'
29
- | 'get'
42
+ | 'deactivate'
43
+ | 'decrypt'
44
+ | 'delete'
45
+ | 'deliver'
46
+ | 'destroy'
47
+ | 'disable'
48
+ | 'disconnect'
49
+ | 'dismiss'
50
+ | 'display'
51
+ | 'download'
52
+ | 'edit'
53
+ | 'enable'
54
+ | 'encrypt'
55
+ | 'end'
56
+ | 'expire'
57
+ | 'fail'
30
58
  | 'fetch'
31
- | 'update'
59
+ | 'fire'
60
+ | 'generate'
61
+ | 'get'
62
+ | 'hide'
63
+ | 'hover'
64
+ | 'ignore'
65
+ | 'initialize'
66
+ | 'initiate'
67
+ | 'invalidate'
68
+ | 'join'
32
69
  | 'list'
33
- | 'delete'
70
+ | 'load'
71
+ | 'login'
72
+ | 'logout'
73
+ | 'notify'
74
+ | 'offer'
75
+ | 'open'
76
+ | 'press'
77
+ | 'receive'
78
+ | 'refer'
79
+ | 'refresh'
80
+ | 'register'
81
+ | 'release'
82
+ | 'reload'
83
+ | 'reject'
84
+ | 'request'
85
+ | 'reset'
86
+ | 'resize'
87
+ | 'respond'
88
+ | 'retry'
89
+ | 'revoke'
90
+ | 'save'
91
+ | 'search'
34
92
  | 'select'
35
- | 'view'
93
+ | 'send'
36
94
  | 'set'
95
+ | 'sign'
96
+ | 'start'
97
+ | 'submit'
98
+ | 'switch'
99
+ | 'sync'
37
100
  | 'toggle'
38
- | 'load'
39
- | 'reload'
40
- | 'click'
41
- | 'hover'
42
- | 'register'
101
+ | 'transfer'
43
102
  | 'unregister'
44
- | 'enable'
45
- | 'disable'
103
+ | 'update'
104
+ | 'upload'
46
105
  | 'use'
47
- | 'complete'
48
- | 'submit'
49
- | 'apply'
50
- | 'cancel'
51
- | 'abort'
52
- | 'sync'
53
- | 'login'
54
- | 'logout'
55
- | 'answer'
56
- | 'activate'
57
- | 'deactivate';
106
+ | 'validate'
107
+ | 'view'
108
+ | 'visit'
109
+ | 'wait'
110
+ | 'warn'
111
+ | 'exit';
58
112
 
59
113
  export type SubmitClientEventOptions = {
60
114
  meetingId?: string;
@@ -115,6 +169,8 @@ export interface DeviceContext {
115
169
 
116
170
  export type MetricType = 'behavioral' | 'operational' | 'business';
117
171
 
172
+ export type Table = 'wbxapp_callend_metrics' | 'business_metrics' | 'business_ucf' | 'default';
173
+
118
174
  type InternalEventPayload = string | number | boolean;
119
175
  export type EventPayload = Record<string, InternalEventPayload>;
120
176
  export type BehavioralEventPayload = EventPayload; // for compatibilty, can be remove after wxcc-desktop did change their imports.
@@ -242,3 +298,19 @@ export type PreComputedLatencies =
242
298
  | 'internal.call.init.join.req'
243
299
  | 'internal.other.app.api.time'
244
300
  | 'internal.api.fetch.intelligence.models';
301
+
302
+ export interface IdType {
303
+ meetingId?: string;
304
+ callId?: string;
305
+ }
306
+
307
+ export interface IMetricsAttributes {
308
+ type: string;
309
+ version: string;
310
+ userId: string;
311
+ correlationId: string;
312
+ connectionId: string;
313
+ data: any[];
314
+ meetingId?: string;
315
+ callId?: string;
316
+ }
@@ -21,6 +21,7 @@ import {
21
21
  MediaQualityEvent,
22
22
  InternalEvent,
23
23
  SubmitClientEventOptions,
24
+ Table,
24
25
  } from './metrics.types';
25
26
  import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
26
27
  import {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';
@@ -28,6 +29,7 @@ import {generateCommonErrorMetadata} from './utils';
28
29
 
29
30
  /**
30
31
  * Metrics plugin to centralize all types of metrics.
32
+ * https://confluence-eng-gpk2.cisco.com/conf/pages/viewpage.action?pageId=231011379
31
33
  * @class
32
34
  */
33
35
  class Metrics extends WebexPlugin {
@@ -201,7 +203,15 @@ class Metrics extends WebexPlugin {
201
203
  * Buisness event
202
204
  * @param args
203
205
  */
204
- submitBusinessEvent({name, payload}: {name: string; payload: EventPayload}) {
206
+ submitBusinessEvent({
207
+ name,
208
+ payload,
209
+ table,
210
+ }: {
211
+ name: string;
212
+ payload: EventPayload;
213
+ table?: Table;
214
+ }) {
205
215
  if (!this.isReady) {
206
216
  // @ts-ignore
207
217
  this.webex.logger.log(
@@ -213,7 +223,7 @@ class Metrics extends WebexPlugin {
213
223
 
214
224
  this.lazyBuildBusinessMetrics();
215
225
 
216
- return this.businessMetrics.submitBusinessEvent({name, payload});
226
+ return this.businessMetrics.submitBusinessEvent({name, payload, table});
217
227
  }
218
228
 
219
229
  /**
@@ -0,0 +1,3 @@
1
+ const RTC_METRICS = {APP_ID: 'FFB51ED5-4319-4C55-8303-B1F2FCCDE231'};
2
+
3
+ export {RTC_METRICS as default};