@webex/internal-plugin-metrics 3.0.0-next.1 → 3.0.0-next.10

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 (31) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +90 -14
  2. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics.js +38 -29
  4. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +8 -1
  6. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/metrics.js +5 -1
  9. package/dist/metrics.js.map +1 -1
  10. package/dist/metrics.types.js.map +1 -1
  11. package/dist/new-metrics.js +5 -4
  12. package/dist/new-metrics.js.map +1 -1
  13. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +41 -8
  14. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +8 -10
  15. package/dist/types/index.d.ts +2 -2
  16. package/dist/types/metrics.types.d.ts +3 -1
  17. package/package.json +13 -13
  18. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +89 -13
  19. package/src/call-diagnostic/call-diagnostic-metrics.ts +13 -0
  20. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +8 -1
  21. package/src/index.ts +2 -0
  22. package/src/metrics.js +3 -0
  23. package/src/metrics.types.ts +12 -1
  24. package/src/new-metrics.ts +2 -2
  25. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +18 -7
  26. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +199 -1
  27. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +119 -24
  28. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +11 -2
  29. package/test/unit/spec/metrics.js +8 -0
  30. package/test/unit/spec/new-metrics.ts +29 -31
  31. package/test/unit/spec/prelogin-metrics-batcher.ts +5 -2
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["metrics.types.ts"],"sourcesContent":["import {\n ClientEvent as RawClientEvent,\n Event as RawEvent,\n MediaQualityEvent as RawMediaQualityEvent,\n} from '@webex/event-dictionary-ts';\n\nexport type Event = Omit<RawEvent, 'event'> & {event: RawClientEvent | RawMediaQualityEvent};\n\nexport type ClientEventError = NonNullable<RawClientEvent['errors']>[0];\n\nexport type EnvironmentType = NonNullable<RawEvent['origin']['environment']>;\n\nexport type NewEnvironmentType = NonNullable<RawEvent['origin']['newEnvironment']>;\n\nexport type ClientLaunchMethodType = NonNullable<\n RawEvent['origin']['clientInfo']\n>['clientLaunchMethod'];\n\nexport type SubmitClientEventOptions = {\n meetingId?: string;\n mediaConnections?: any[];\n rawError?: any;\n correlationId?: string;\n preLoginId?: string;\n environment?: EnvironmentType;\n newEnvironmentType?: NewEnvironmentType;\n clientLaunchMethod?: ClientLaunchMethodType;\n webexConferenceIdStr?: string;\n globalMeetingId?: string;\n};\n\nexport type SubmitMQEOptions = {\n meetingId: string;\n mediaConnections?: any[];\n networkType?: Event['origin']['networkType'];\n webexConferenceIdStr?: string;\n globalMeetingId?: string;\n};\n\nexport type InternalEvent = {\n name:\n | 'internal.client.meetinginfo.request'\n | 'internal.client.meetinginfo.response'\n | 'internal.register.device.request'\n | 'internal.register.device.response'\n | 'internal.reset.join.latencies'\n | 'internal.client.meeting.click.joinbutton'\n | 'internal.host.meeting.participant.admitted'\n | 'internal.client.meeting.interstitial-window.showed'\n | 'internal.client.interstitial-window.click.joinbutton'\n | 'internal.client.add-media.turn-discovery.start'\n | 'internal.client.add-media.turn-discovery.end';\n\n payload?: never;\n options?: never;\n};\n\nexport interface ClientEvent {\n name: RawClientEvent['name'];\n payload?: RawClientEvent;\n options?: SubmitClientEventOptions;\n}\n\nexport interface BehavioralEvent {\n // TODO: not implemented\n name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';\n payload?: never;\n options?: never;\n}\n\nexport interface OperationalEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface FeatureEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface MediaQualityEvent {\n name: RawMediaQualityEvent['name'];\n payload?: RawMediaQualityEvent;\n options: SubmitMQEOptions;\n}\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\n\nexport type MetricEventNames =\n | InternalEvent['name']\n | ClientEvent['name']\n | BehavioralEvent['name']\n | OperationalEvent['name']\n | FeatureEvent['name']\n | MediaQualityEvent['name'];\n\nexport type ClientInfo = NonNullable<RawEvent['origin']['clientInfo']>;\nexport type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];\nexport type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];\nexport type NetworkType = NonNullable<RawEvent['origin']>['networkType'];\n\nexport type ClientSubServiceType = ClientEvent['payload']['webexSubServiceType'];\nexport type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;\nexport type ClientEventLeaveReason = ClientEvent['payload']['leaveReason'];\nexport type ClientEventPayloadError = ClientEvent['payload']['errors'];\n\nexport type MediaQualityEventAudioSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['audioSetupDelay'];\nexport type MediaQualityEventVideoSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['videoSetupDelay'];\n\nexport type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];\n};\n\nexport type SubmitInternalEvent = (args: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitBehavioralEvent = (args: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitClientEvent = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type SubmitOperationalEvent = (args: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitMQE = (args: {\n name: MediaQualityEvent['name'];\n payload: SubmitMQEPayload;\n options: any;\n}) => void;\n\nexport type BuildClientEventFetchRequestOptions = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type PreComputedLatencies =\n | 'internal.client.pageJMT'\n | 'internal.download.time'\n | 'internal.click.to.interstitial'\n | 'internal.call.init.join.req';\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["metrics.types.ts"],"sourcesContent":["import {\n ClientEvent as RawClientEvent,\n Event as RawEvent,\n MediaQualityEvent as RawMediaQualityEvent,\n} from '@webex/event-dictionary-ts';\n\nexport type Event = Omit<RawEvent, 'event'> & {event: RawClientEvent | RawMediaQualityEvent};\n\nexport type ClientEventError = NonNullable<RawClientEvent['errors']>[0];\n\nexport type EnvironmentType = NonNullable<RawEvent['origin']['environment']>;\n\nexport type NewEnvironmentType = NonNullable<RawEvent['origin']['newEnvironment']>;\n\nexport type ClientLaunchMethodType = NonNullable<\n RawEvent['origin']['clientInfo']\n>['clientLaunchMethod'];\n\nexport type BrowserLaunchMethodType = NonNullable<\n RawEvent['origin']['clientInfo']\n>['browserLaunchMethod'];\n\nexport type SubmitClientEventOptions = {\n meetingId?: string;\n mediaConnections?: any[];\n rawError?: any;\n correlationId?: string;\n preLoginId?: string;\n environment?: EnvironmentType;\n newEnvironmentType?: NewEnvironmentType;\n clientLaunchMethod?: ClientLaunchMethodType;\n browserLaunchMethod?: BrowserLaunchMethodType;\n webexConferenceIdStr?: string;\n globalMeetingId?: string;\n};\n\nexport type SubmitMQEOptions = {\n meetingId: string;\n mediaConnections?: any[];\n networkType?: Event['origin']['networkType'];\n webexConferenceIdStr?: string;\n globalMeetingId?: string;\n};\n\nexport type InternalEvent = {\n name:\n | 'internal.client.meetinginfo.request'\n | 'internal.client.meetinginfo.response'\n | 'internal.register.device.request'\n | 'internal.register.device.response'\n | 'internal.reset.join.latencies'\n | 'internal.client.meeting.click.joinbutton'\n | 'internal.host.meeting.participant.admitted'\n | 'internal.client.meeting.interstitial-window.showed'\n | 'internal.client.interstitial-window.click.joinbutton'\n | 'internal.client.add-media.turn-discovery.start'\n | 'internal.client.add-media.turn-discovery.end';\n\n payload?: never;\n options?: never;\n};\n\nexport interface ClientEvent {\n name: RawClientEvent['name'];\n payload?: RawClientEvent;\n options?: SubmitClientEventOptions;\n}\n\nexport interface BehavioralEvent {\n // TODO: not implemented\n name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';\n payload?: never;\n options?: never;\n}\n\nexport interface OperationalEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface FeatureEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface MediaQualityEvent {\n name: RawMediaQualityEvent['name'];\n payload?: RawMediaQualityEvent;\n options: SubmitMQEOptions;\n}\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\n\nexport type MetricEventNames =\n | InternalEvent['name']\n | ClientEvent['name']\n | BehavioralEvent['name']\n | OperationalEvent['name']\n | FeatureEvent['name']\n | MediaQualityEvent['name'];\n\nexport type ClientInfo = NonNullable<RawEvent['origin']['clientInfo']>;\nexport type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];\nexport type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];\nexport type NetworkType = NonNullable<RawEvent['origin']>['networkType'];\n\nexport type ClientSubServiceType = ClientEvent['payload']['webexSubServiceType'];\nexport type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;\nexport type ClientEventLeaveReason = ClientEvent['payload']['leaveReason'];\nexport type ClientEventPayloadError = ClientEvent['payload']['errors'];\n\nexport type MediaQualityEventAudioSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['audioSetupDelay'];\nexport type MediaQualityEventVideoSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['videoSetupDelay'];\n\nexport type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];\n};\n\nexport type SubmitInternalEvent = (args: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitBehavioralEvent = (args: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitClientEvent = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type SubmitOperationalEvent = (args: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitMQE = (args: {\n name: MediaQualityEvent['name'];\n payload: SubmitMQEPayload;\n options: any;\n}) => void;\n\nexport type BuildClientEventFetchRequestOptions = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type PreComputedLatencies =\n | 'internal.client.pageJMT'\n | 'internal.download.time'\n | 'internal.get.cluster.time'\n | 'internal.click.to.interstitial'\n | 'internal.refresh.captcha.time'\n | 'internal.exchange.ci.token.time'\n | 'internal.get.u2c.time'\n | 'internal.call.init.join.req'\n | 'internal.other.app.api.time'\n | 'internal.api.fetch.intelligence.models';\n"],"mappings":""}
@@ -50,10 +50,15 @@ var Metrics = /*#__PURE__*/function (_WebexPlugin) {
50
50
  args[_key] = arguments[_key];
51
51
  }
52
52
  _this = _super.call.apply(_super, [this].concat(args));
53
+
54
+ // @ts-ignore
53
55
  // Call Diagnostic latencies
54
56
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticLatencies", void 0);
55
57
  // Helper classes to handle the different types of metrics
56
58
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticMetrics", void 0);
59
+ _this.callDiagnosticLatencies = new _callDiagnosticMetricsLatencies.default({}, {
60
+ parent: _this.webex
61
+ });
57
62
  _this.onReady();
58
63
  return _this;
59
64
  }
@@ -71,10 +76,6 @@ var Metrics = /*#__PURE__*/function (_WebexPlugin) {
71
76
  _this2.callDiagnosticMetrics = new _callDiagnosticMetrics.default({}, {
72
77
  parent: _this2.webex
73
78
  });
74
- // @ts-ignore
75
- _this2.callDiagnosticLatencies = new _callDiagnosticMetricsLatencies.default({}, {
76
- parent: _this2.webex
77
- });
78
79
  });
79
80
  }
80
81
 
@@ -1 +1 @@
1
- {"version":3,"names":["_webexCore","require","_callDiagnosticMetrics","_interopRequireDefault","_callDiagnosticMetricsLatencies","_callDiagnosticMetrics2","_utils","_class","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","Metrics","_WebexPlugin","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","onReady","_createClass2","key","value","_this2","webex","once","callDiagnosticMetrics","CallDiagnosticMetrics","parent","callDiagnosticLatencies","CallDiagnosticLatencies","submitInternalEvent","_ref","name","payload","options","clearTimestamps","saveTimestamp","submitBehavioralEvent","_ref2","Error","submitOperationalEvent","_ref3","submitMQE","_ref4","submitFeatureEvent","_ref5","submitClientEvent","_ref6","logger","log","_promise","resolve","meetingId","clientMetricsAliasUser","preLoginId","_this3","request","method","api","resource","headers","body","qs","alias","then","res","catch","err","error","generateCommonErrorMetadata","reject","_buildClientEventFetchRequestOptions","_asyncToGenerator2","_regenerator","mark","_callee","_ref7","wrap","_callee$","_context","prev","next","abrupt","buildClientEventFetchRequestOptions","stop","_x","setMetricTimingsAndFetch","setTimingsAndFetch","setMetricTimings","isServiceErrorExpected","serviceErrorCode","WebexPlugin","_default","exports"],"sources":["new-metrics.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\n\n// @ts-ignore\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';\nimport {\n RecursivePartial,\n ClientEvent,\n FeatureEvent,\n BehavioralEvent,\n OperationalEvent,\n MediaQualityEvent,\n InternalEvent,\n SubmitClientEventOptions,\n} from './metrics.types';\nimport CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';\nimport {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';\nimport {generateCommonErrorMetadata} from './utils';\n\n/**\n * Metrics plugin to centralize all types of metrics.\n * @class\n */\nclass Metrics extends WebexPlugin {\n // eslint-disable-next-line no-use-before-define\n static instance: Metrics;\n\n // Call Diagnostic latencies\n callDiagnosticLatencies: CallDiagnosticLatencies;\n // Helper classes to handle the different types of metrics\n callDiagnosticMetrics: CallDiagnosticMetrics;\n\n /**\n * Constructor\n * @param args\n * @constructor\n * @private\n * @returns\n */\n constructor(...args) {\n super(...args);\n\n this.onReady();\n }\n\n /**\n * On Ready\n */\n private onReady() {\n // @ts-ignore\n this.webex.once('ready', () => {\n // @ts-ignore\n this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});\n // @ts-ignore\n this.callDiagnosticLatencies = new CallDiagnosticLatencies({}, {parent: this.webex});\n });\n }\n\n /**\n * Used for internal purposes only\n * @param args\n */\n submitInternalEvent({\n name,\n payload,\n options,\n }: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n }) {\n if (name === 'internal.reset.join.latencies') {\n this.callDiagnosticLatencies.clearTimestamps();\n } else {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n }\n }\n\n /**\n * Behavioral event\n * @param args\n */\n submitBehavioralEvent({\n name,\n payload,\n options,\n }: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n throw new Error('Not implemented.');\n }\n\n /**\n * Operational event\n * @param args\n */\n submitOperationalEvent({\n name,\n payload,\n options,\n }: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Media Quality Event\n * @param args\n */\n submitMQE({\n name,\n payload,\n options,\n }: {\n name: MediaQualityEvent['name'];\n payload: RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: MediaQualityEvent['payload']['intervals'];\n };\n options: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n this.callDiagnosticMetrics.submitMQE({name, payload, options});\n }\n\n /**\n * Call Analyzer: Feature Usage Event\n * @param args\n */\n submitFeatureEvent({\n name,\n payload,\n options,\n }: {\n name: FeatureEvent['name'];\n payload?: RecursivePartial<FeatureEvent['payload']>;\n options: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Client Event\n * @public\n * @param args\n */\n public submitClientEvent({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n }): Promise<any> {\n if (!this.callDiagnosticLatencies || !this.callDiagnosticMetrics) {\n // @ts-ignore\n this.webex.logger.log(\n `NewMetrics: @submitClientEvent. Attempted to submit before webex.ready. Event name: ${name}`\n );\n\n return Promise.resolve();\n }\n this.callDiagnosticLatencies.saveTimestamp({\n key: name,\n options: {meetingId: options?.meetingId},\n });\n\n return this.callDiagnosticMetrics.submitClientEvent({name, payload, options});\n }\n\n /**\n * Issue request to alias a user's pre-login ID with their CI UUID\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n public clientMetricsAliasUser(preLoginId: string) {\n // @ts-ignore\n return this.webex\n .request({\n method: 'POST',\n api: 'metrics',\n resource: 'clientmetrics',\n headers: {\n 'x-prelogin-userid': preLoginId,\n },\n body: {},\n qs: {\n alias: true,\n },\n })\n .then((res) => {\n // @ts-ignore\n this.webex.logger.log(`NewMetrics: @clientMetricsAliasUser. Request successful.`);\n\n return res;\n })\n .catch((err) => {\n // @ts-ignore\n this.logger.error(\n `NewMetrics: @clientMetricsAliasUser. Request failed:`,\n `err: ${generateCommonErrorMetadata(err)}`\n );\n\n return Promise.reject(err);\n });\n }\n\n /**\n * Returns a promise that will resolve to fetch options for submitting a metric.\n *\n * This is to support quickly submitting metrics when the browser/tab is closing.\n * Calling submitClientEvent will not work because there some async steps that will\n * not complete before the browser is closed. Instead, we pre-gather all the\n * information/options needed for the request(s), and then simply and quickly\n * fire the fetch(es) when beforeUnload is triggered.\n *\n * We must use fetch instead of request because fetch has a keepalive option that\n * allows the request it to outlive the page.\n *\n * Note: the timings values will be wrong, but setMetricTimingsAndFetch() will\n * properly adjust them before submitting.\n *\n * @public\n * @param {Object} arg\n * @param {String} arg.name - event name\n * @param {Object} arg.payload - event payload\n * @param {Object} arg.options - other options\n * @returns {Promise} promise that resolves to options to be used with fetch\n */\n public async buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n }): Promise<any> {\n return this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n });\n }\n\n /**\n * Submits a metric from pre-built request options via the fetch API. Updates\n * the \"$timings\" and \"originTime\" values to Date.now() since the existing times\n * were set when the options were built (not submitted).\n\n * @param {any} options - the pre-built request options for submitting a metric\n * @returns {Promise} promise that resolves to the response object\n */\n public setMetricTimingsAndFetch(options: any): Promise<any> {\n // @ts-ignore\n return this.webex.setTimingsAndFetch(setMetricTimings(options));\n }\n\n /**\n * Returns true if the specified serviceErrorCode maps to an expected error.\n * @param {number} serviceErrorCode the service error code\n * @returns {boolean}\n */\n public isServiceErrorExpected(serviceErrorCode: number): boolean {\n return this.callDiagnosticMetrics.isServiceErrorExpected(serviceErrorCode);\n }\n}\n\nexport default Metrics;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAWA,IAAAG,+BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAoD,IAAAM,MAAA;AApBpD;AACA;AACA;AAEA;AAAA,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA;AAkBA;AACA;AACA;AACA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callDiagnosticMetricsLatencies","_callDiagnosticMetrics2","_utils","_class","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","Metrics","_WebexPlugin","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","callDiagnosticLatencies","CallDiagnosticLatencies","parent","webex","onReady","_createClass2","key","value","_this2","once","callDiagnosticMetrics","CallDiagnosticMetrics","submitInternalEvent","_ref","name","payload","options","clearTimestamps","saveTimestamp","submitBehavioralEvent","_ref2","Error","submitOperationalEvent","_ref3","submitMQE","_ref4","submitFeatureEvent","_ref5","submitClientEvent","_ref6","logger","log","_promise","resolve","meetingId","clientMetricsAliasUser","preLoginId","_this3","request","method","api","resource","headers","body","qs","alias","then","res","catch","err","error","generateCommonErrorMetadata","reject","_buildClientEventFetchRequestOptions","_asyncToGenerator2","_regenerator","mark","_callee","_ref7","wrap","_callee$","_context","prev","next","abrupt","buildClientEventFetchRequestOptions","stop","_x","setMetricTimingsAndFetch","setTimingsAndFetch","setMetricTimings","isServiceErrorExpected","serviceErrorCode","WebexPlugin","_default","exports"],"sources":["new-metrics.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\n\n// @ts-ignore\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';\nimport {\n RecursivePartial,\n ClientEvent,\n FeatureEvent,\n BehavioralEvent,\n OperationalEvent,\n MediaQualityEvent,\n InternalEvent,\n SubmitClientEventOptions,\n} from './metrics.types';\nimport CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';\nimport {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';\nimport {generateCommonErrorMetadata} from './utils';\n\n/**\n * Metrics plugin to centralize all types of metrics.\n * @class\n */\nclass Metrics extends WebexPlugin {\n // eslint-disable-next-line no-use-before-define\n static instance: Metrics;\n\n // Call Diagnostic latencies\n callDiagnosticLatencies: CallDiagnosticLatencies;\n // Helper classes to handle the different types of metrics\n callDiagnosticMetrics: CallDiagnosticMetrics;\n\n /**\n * Constructor\n * @param args\n * @constructor\n * @private\n * @returns\n */\n constructor(...args) {\n super(...args);\n\n // @ts-ignore\n this.callDiagnosticLatencies = new CallDiagnosticLatencies({}, {parent: this.webex});\n this.onReady();\n }\n\n /**\n * On Ready\n */\n private onReady() {\n // @ts-ignore\n this.webex.once('ready', () => {\n // @ts-ignore\n this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});\n });\n }\n\n /**\n * Used for internal purposes only\n * @param args\n */\n submitInternalEvent({\n name,\n payload,\n options,\n }: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n }) {\n if (name === 'internal.reset.join.latencies') {\n this.callDiagnosticLatencies.clearTimestamps();\n } else {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n }\n }\n\n /**\n * Behavioral event\n * @param args\n */\n submitBehavioralEvent({\n name,\n payload,\n options,\n }: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n throw new Error('Not implemented.');\n }\n\n /**\n * Operational event\n * @param args\n */\n submitOperationalEvent({\n name,\n payload,\n options,\n }: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Media Quality Event\n * @param args\n */\n submitMQE({\n name,\n payload,\n options,\n }: {\n name: MediaQualityEvent['name'];\n payload: RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: MediaQualityEvent['payload']['intervals'];\n };\n options: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n this.callDiagnosticMetrics.submitMQE({name, payload, options});\n }\n\n /**\n * Call Analyzer: Feature Usage Event\n * @param args\n */\n submitFeatureEvent({\n name,\n payload,\n options,\n }: {\n name: FeatureEvent['name'];\n payload?: RecursivePartial<FeatureEvent['payload']>;\n options: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Client Event\n * @public\n * @param args\n */\n public submitClientEvent({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n }): Promise<any> {\n if (!this.callDiagnosticLatencies || !this.callDiagnosticMetrics) {\n // @ts-ignore\n this.webex.logger.log(\n `NewMetrics: @submitClientEvent. Attempted to submit before webex.ready. Event name: ${name}`\n );\n\n return Promise.resolve();\n }\n this.callDiagnosticLatencies.saveTimestamp({\n key: name,\n options: {meetingId: options?.meetingId},\n });\n\n return this.callDiagnosticMetrics.submitClientEvent({name, payload, options});\n }\n\n /**\n * Issue request to alias a user's pre-login ID with their CI UUID\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n public clientMetricsAliasUser(preLoginId: string) {\n // @ts-ignore\n return this.webex\n .request({\n method: 'POST',\n api: 'metrics',\n resource: 'clientmetrics',\n headers: {\n 'x-prelogin-userid': preLoginId,\n },\n body: {},\n qs: {\n alias: true,\n },\n })\n .then((res) => {\n // @ts-ignore\n this.webex.logger.log(`NewMetrics: @clientMetricsAliasUser. Request successful.`);\n\n return res;\n })\n .catch((err) => {\n // @ts-ignore\n this.logger.error(\n `NewMetrics: @clientMetricsAliasUser. Request failed:`,\n `err: ${generateCommonErrorMetadata(err)}`\n );\n\n return Promise.reject(err);\n });\n }\n\n /**\n * Returns a promise that will resolve to fetch options for submitting a metric.\n *\n * This is to support quickly submitting metrics when the browser/tab is closing.\n * Calling submitClientEvent will not work because there some async steps that will\n * not complete before the browser is closed. Instead, we pre-gather all the\n * information/options needed for the request(s), and then simply and quickly\n * fire the fetch(es) when beforeUnload is triggered.\n *\n * We must use fetch instead of request because fetch has a keepalive option that\n * allows the request it to outlive the page.\n *\n * Note: the timings values will be wrong, but setMetricTimingsAndFetch() will\n * properly adjust them before submitting.\n *\n * @public\n * @param {Object} arg\n * @param {String} arg.name - event name\n * @param {Object} arg.payload - event payload\n * @param {Object} arg.options - other options\n * @returns {Promise} promise that resolves to options to be used with fetch\n */\n public async buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options?: SubmitClientEventOptions;\n }): Promise<any> {\n return this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n });\n }\n\n /**\n * Submits a metric from pre-built request options via the fetch API. Updates\n * the \"$timings\" and \"originTime\" values to Date.now() since the existing times\n * were set when the options were built (not submitted).\n\n * @param {any} options - the pre-built request options for submitting a metric\n * @returns {Promise} promise that resolves to the response object\n */\n public setMetricTimingsAndFetch(options: any): Promise<any> {\n // @ts-ignore\n return this.webex.setTimingsAndFetch(setMetricTimings(options));\n }\n\n /**\n * Returns true if the specified serviceErrorCode maps to an expected error.\n * @param {number} serviceErrorCode the service error code\n * @returns {boolean}\n */\n public isServiceErrorExpected(serviceErrorCode: number): boolean {\n return this.callDiagnosticMetrics.isServiceErrorExpected(serviceErrorCode);\n }\n}\n\nexport default Metrics;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAWA,IAAAG,+BAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,uBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAoD,IAAAM,MAAA;AApBpD;AACA;AACA;AAEA;AAAA,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAA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AAO,IAAI,CAACb,KAAK,CAACkE,kBAAkB,CAAC,IAAAC,wCAAgB,EAACtD,OAAO,CAAC,CAAC;IACjE;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAAV,GAAA;IAAAC,KAAA,EAKA,SAAAgE,uBAA8BC,gBAAwB,EAAW;MAC/D,OAAO,IAAI,CAAC9D,qBAAqB,CAAC6D,sBAAsB,CAACC,gBAAgB,CAAC;IAC5E;EAAC;EAAA,OAAAtF,OAAA;AAAA,EAxPmBuF,sBAAW;AAAA/G,MAAA,GAA3BwB,OAAO;AACX;AAAA,IAAAY,gBAAA,CAAA5B,OAAA,EADIgB,OAAO;AAAA,IAAAwF,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GA2PEgB,OAAO"}
@@ -30,7 +30,8 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
30
30
  /**
31
31
  * Store timestamp value
32
32
  * @param key - key
33
- * @param value -value
33
+ * @param value - value
34
+ * @param options - store options
34
35
  * @throws
35
36
  * @returns
36
37
  */
@@ -44,11 +45,20 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
44
45
  /**
45
46
  * Store precomputed latency value
46
47
  * @param key - key
47
- * @param value -value
48
+ * @param value - value
49
+ * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement
48
50
  * @throws
49
51
  * @returns
50
52
  */
51
- saveLatency(key: PreComputedLatencies, value: number): void;
53
+ saveLatency(key: PreComputedLatencies, value: number, accumulate?: boolean): void;
54
+ /**
55
+ * Measure latency for a request
56
+ * @param callback - callback for which you would like to measure latency
57
+ * @param key - key
58
+ * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement
59
+ * @returns
60
+ */
61
+ measureLatency(callback: () => Promise<unknown>, key: PreComputedLatencies, accumulate?: boolean): Promise<unknown>;
52
62
  /**
53
63
  * Store only the first timestamp value for the given key
54
64
  * @param key - key
@@ -80,6 +90,11 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
80
90
  * @returns - latency
81
91
  */
82
92
  getShowInterstitialTime(): number;
93
+ /**
94
+ * getU2CTime
95
+ * @returns - latency
96
+ */
97
+ getU2CTime(): number;
83
98
  /**
84
99
  * Device Register Time
85
100
  * @returns - latency
@@ -95,11 +110,6 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
95
110
  * @returns - latency
96
111
  */
97
112
  getJoinReqResp(): number;
98
- /**
99
- * Locus Join Response Sent Received
100
- * @returns - latency
101
- */
102
- getJoinRespSentReceived(): any;
103
113
  /**
104
114
  * Time taken to do turn discovery
105
115
  * @returns - latency
@@ -193,6 +203,10 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
193
203
  * Video setup delay receive
194
204
  */
195
205
  getVideoJoinRespRxStart(): number;
206
+ /**
207
+ * Total latency for all get cluster request.
208
+ */
209
+ getReachabilityClustersReqResp(): number;
196
210
  /**
197
211
  * Audio setup delay transmit
198
212
  */
@@ -201,4 +215,23 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
201
215
  * Video setup delay transmit
202
216
  */
203
217
  getVideoJoinRespTxStart(): number;
218
+ /**
219
+ * Total latency for all exchange ci token.
220
+ */
221
+ getExchangeCITokenJMT(): number;
222
+ /**
223
+ * Total latency for all refresh captcha requests.
224
+ */
225
+ getRefreshCaptchaReqResp(): number;
226
+ /**
227
+ * Get the latency for downloading intelligence models.
228
+ * @returns - latency
229
+ */
230
+ getDownloadIntelligenceModelsReqResp(): number;
231
+ /**
232
+ * Get the total latency for all other app API requests.
233
+ * Excludes meeting info, because it's measured separately.
234
+ * @returns - latency
235
+ */
236
+ getOtherAppApiReqResp(): number;
204
237
  }
@@ -1,10 +1,11 @@
1
1
  import { StatelessWebexPlugin } from '@webex/webex-core';
2
- import { Event, ClientType, SubClientType, NetworkType, EnvironmentType, NewEnvironmentType, ClientEvent, SubmitClientEventOptions, MediaQualityEvent, SubmitMQEOptions, SubmitMQEPayload, ClientLaunchMethodType, ClientEventError, ClientEventPayload, ClientSubServiceType } from '../metrics.types';
2
+ import { Event, ClientType, SubClientType, NetworkType, EnvironmentType, NewEnvironmentType, ClientEvent, SubmitClientEventOptions, MediaQualityEvent, SubmitMQEOptions, SubmitMQEPayload, ClientLaunchMethodType, ClientEventError, ClientEventPayload, ClientSubServiceType, BrowserLaunchMethodType } from '../metrics.types';
3
3
  type GetOriginOptions = {
4
4
  clientType: ClientType;
5
5
  subClientType: SubClientType;
6
6
  networkType?: NetworkType;
7
7
  clientLaunchMethod?: ClientLaunchMethodType;
8
+ browserLaunchMethod?: BrowserLaunchMethodType;
8
9
  environment?: EnvironmentType;
9
10
  newEnvironment?: NewEnvironmentType;
10
11
  };
@@ -87,18 +88,12 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
87
88
  browser?: string;
88
89
  browserVersion?: string;
89
90
  clientType?: "MEETING_CENTER" | "EVENT_CENTER" | "TRAINING_CENTER" | "TEAMS_CLIENT" | "TEAMS_DEVICE" | "TEAMS_SHARE" | "SIP" | "RECORDING" | "CLOUD_AWARE_SIP" | "TEAMS_WXC_CLIENT" | "WXC_CLIENT" | "WXC_DEVICE" | "WEBEX_JS_SDK" | "VOICEA_CLIENT" | "CISCO_SIP_GW" | "WEBEX_SDK" | "CPAAS_THIRD_PARTY_SDK" | "WXC_THIRD_PARTY" | "WXCC";
90
- subClientType?: "TEAMS_DEVICE" | "DESKTOP_APP" | "DESKTOP_APP_VDI" | "DEVICE_CURRENT" | "DEVICE_LEGACY_2020" | "HOLOGRAM_HEADSET_APP" | "HVDI_APP" | "MOBILE_APP" | "MOBILE_NETWORK" | "VDI_APP" | "WEB_APP";
91
- clientVersion?: string; /**
92
- * Returns the login type of the current user
93
- * @returns one of 'login-ci','unverified-guest', null
94
- */
91
+ subClientType?: "TEAMS_DEVICE" | "DESKTOP_APP" | "DESKTOP_APP_VDI" | "DEVICE_CURRENT" | "DEVICE_LEGACY_2020" | "HOLOGRAM_HEADSET_APP" | "HVDI_APP" | "MIXED" | "MOBILE_APP" | "MOBILE_NETWORK" | "PAGE" | "VDI_APP" | "WEB_APP";
92
+ clientVersion?: string;
95
93
  clientVersionStatus?: "CURRENT" | "LEGACY" | "UNSUPPORTED";
96
94
  localClientVersion?: string;
97
95
  modelNumber?: string;
98
- joinFirstUpdateLater?: "ep-enabled" | "sp-enabled" | "not-enabled"; /**
99
- * Returns if the meeting has converged architecture enabled
100
- * @param options.meetingId
101
- */
96
+ joinFirstUpdateLater?: "ep-enabled" | "sp-enabled" | "not-enabled";
102
97
  standbyUsed?: boolean;
103
98
  prefetchDocShowUsed?: boolean;
104
99
  fastJoinUsed?: boolean;
@@ -185,6 +180,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
185
180
  meetingOrgId?: string;
186
181
  msteamsTenantGuid?: string;
187
182
  msteamsConferenceId?: string;
183
+ msteamsMeetingId?: string;
188
184
  oauth2ClientId?: string;
189
185
  orgId?: string;
190
186
  provisionalCorrelationId?: string;
@@ -256,6 +252,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
256
252
  meetingOrgId?: string;
257
253
  msteamsTenantGuid?: string;
258
254
  msteamsConferenceId?: string;
255
+ msteamsMeetingId?: string;
259
256
  oauth2ClientId?: string;
260
257
  orgId?: string;
261
258
  provisionalCorrelationId?: string;
@@ -346,6 +343,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
346
343
  errorCodeExt1?: number;
347
344
  errorData?: {};
348
345
  rawErrorMessage?: string;
346
+ mediaDeviceErrors?: string;
349
347
  shownToUser: boolean;
350
348
  serviceErrorCode?: number;
351
349
  name: "other" | "locus.response" | "media-engine" | "ice.failed" | "locus.leave" | "client.leave" | "media-device" | "media-sca" | "wxc";
@@ -5,11 +5,11 @@ import '@webex/internal-plugin-device';
5
5
  import config from './config';
6
6
  import NewMetrics from './new-metrics';
7
7
  import * as Utils from './utils';
8
- import { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitOperationalEvent, SubmitMQE } from './metrics.types';
8
+ import { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitOperationalEvent, SubmitMQE, PreComputedLatencies } from './metrics.types';
9
9
  import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
10
10
  import * as CallDiagnosticUtils from './call-diagnostic/call-diagnostic-metrics.util';
11
11
  import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
12
12
  import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
13
13
  export { default, getOSNameInternal } from './metrics';
14
14
  export { config, CALL_DIAGNOSTIC_CONFIG, NewMetrics, Utils, CallDiagnosticUtils, CallDiagnosticLatencies, CallDiagnosticMetrics, };
15
- export type { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitMQE, SubmitOperationalEvent, };
15
+ export type { ClientEvent, ClientEventLeaveReason, SubmitBehavioralEvent, SubmitClientEvent, SubmitInternalEvent, SubmitMQE, SubmitOperationalEvent, PreComputedLatencies, };
@@ -6,6 +6,7 @@ export type ClientEventError = NonNullable<RawClientEvent['errors']>[0];
6
6
  export type EnvironmentType = NonNullable<RawEvent['origin']['environment']>;
7
7
  export type NewEnvironmentType = NonNullable<RawEvent['origin']['newEnvironment']>;
8
8
  export type ClientLaunchMethodType = NonNullable<RawEvent['origin']['clientInfo']>['clientLaunchMethod'];
9
+ export type BrowserLaunchMethodType = NonNullable<RawEvent['origin']['clientInfo']>['browserLaunchMethod'];
9
10
  export type SubmitClientEventOptions = {
10
11
  meetingId?: string;
11
12
  mediaConnections?: any[];
@@ -15,6 +16,7 @@ export type SubmitClientEventOptions = {
15
16
  environment?: EnvironmentType;
16
17
  newEnvironmentType?: NewEnvironmentType;
17
18
  clientLaunchMethod?: ClientLaunchMethodType;
19
+ browserLaunchMethod?: BrowserLaunchMethodType;
18
20
  webexConferenceIdStr?: string;
19
21
  globalMeetingId?: string;
20
22
  };
@@ -102,4 +104,4 @@ export type BuildClientEventFetchRequestOptions = (args: {
102
104
  payload?: RecursivePartial<ClientEvent['payload']>;
103
105
  options?: SubmitClientEventOptions;
104
106
  }) => Promise<any>;
105
- export type PreComputedLatencies = 'internal.client.pageJMT' | 'internal.download.time' | 'internal.click.to.interstitial' | 'internal.call.init.join.req';
107
+ 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';
package/package.json CHANGED
@@ -26,23 +26,23 @@
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.0.0-next.1",
30
- "@webex/test-helper-mocha": "3.0.0-next.1",
31
- "@webex/test-helper-mock-webex": "3.0.0-next.1",
32
- "@webex/test-helper-test-users": "3.0.0-next.1",
29
+ "@webex/test-helper-chai": "3.0.0-next.10",
30
+ "@webex/test-helper-mocha": "3.0.0-next.10",
31
+ "@webex/test-helper-mock-webex": "3.0.0-next.10",
32
+ "@webex/test-helper-test-users": "3.0.0-next.10",
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.0.0-next.1",
39
- "@webex/common-timers": "3.0.0-next.1",
40
- "@webex/event-dictionary-ts": "^1.0.1329",
41
- "@webex/internal-plugin-device": "3.0.0-next.1",
42
- "@webex/internal-plugin-metrics": "3.0.0-next.1",
43
- "@webex/test-helper-chai": "3.0.0-next.1",
44
- "@webex/test-helper-mock-webex": "3.0.0-next.1",
45
- "@webex/webex-core": "3.0.0-next.1",
38
+ "@webex/common": "3.0.0-next.10",
39
+ "@webex/common-timers": "3.0.0-next.10",
40
+ "@webex/event-dictionary-ts": "^1.0.1406",
41
+ "@webex/internal-plugin-device": "3.0.0-next.10",
42
+ "@webex/internal-plugin-metrics": "3.0.0-next.10",
43
+ "@webex/test-helper-chai": "3.0.0-next.10",
44
+ "@webex/test-helper-mock-webex": "3.0.0-next.10",
45
+ "@webex/webex-core": "3.0.0-next.10",
46
46
  "ip-anonymize": "^0.1.0",
47
47
  "lodash": "^4.17.21",
48
48
  "uuid": "^3.3.2"
@@ -55,5 +55,5 @@
55
55
  "test:style": "eslint ./src/**/*.*",
56
56
  "test:unit": "webex-legacy-tools test --unit --runner mocha"
57
57
  },
58
- "version": "3.0.0-next.1"
58
+ "version": "3.0.0-next.10"
59
59
  }
@@ -31,6 +31,7 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
31
31
  */
32
32
  public clearTimestamps() {
33
33
  this.latencyTimestamps.clear();
34
+ this.precomputedLatencies.clear();
34
35
  }
35
36
 
36
37
  /**
@@ -57,7 +58,8 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
57
58
  /**
58
59
  * Store timestamp value
59
60
  * @param key - key
60
- * @param value -value
61
+ * @param value - value
62
+ * @param options - store options
61
63
  * @throws
62
64
  * @returns
63
65
  */
@@ -92,12 +94,33 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
92
94
  /**
93
95
  * Store precomputed latency value
94
96
  * @param key - key
95
- * @param value -value
97
+ * @param value - value
98
+ * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement
96
99
  * @throws
97
100
  * @returns
98
101
  */
99
- public saveLatency(key: PreComputedLatencies, value: number) {
100
- this.precomputedLatencies.set(key, value);
102
+ public saveLatency(key: PreComputedLatencies, value: number, accumulate = false) {
103
+ const existingValue = accumulate ? this.precomputedLatencies.get(key) || 0 : 0;
104
+ this.precomputedLatencies.set(key, value + existingValue);
105
+ }
106
+
107
+ /**
108
+ * Measure latency for a request
109
+ * @param callback - callback for which you would like to measure latency
110
+ * @param key - key
111
+ * @param accumulate - when it is true, it overwrites existing value with sum of the current value and the new measurement otherwise just store the new measurement
112
+ * @returns
113
+ */
114
+ public measureLatency(
115
+ callback: () => Promise<unknown>,
116
+ key: PreComputedLatencies,
117
+ accumulate = false
118
+ ) {
119
+ const start = performance.now();
120
+
121
+ return callback().finally(() => {
122
+ this.saveLatency(key, performance.now() - start, accumulate);
123
+ });
101
124
  }
102
125
 
103
126
  /**
@@ -158,6 +181,16 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
158
181
  );
159
182
  }
160
183
 
184
+ /**
185
+ * getU2CTime
186
+ * @returns - latency
187
+ */
188
+ public getU2CTime() {
189
+ const u2cLatency = this.precomputedLatencies.get('internal.get.u2c.time');
190
+
191
+ return u2cLatency ? Math.floor(u2cLatency) : undefined;
192
+ }
193
+
161
194
  /**
162
195
  * Device Register Time
163
196
  * @returns - latency
@@ -188,15 +221,6 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
188
221
  return this.getDiffBetweenTimestamps('client.locus.join.request', 'client.locus.join.response');
189
222
  }
190
223
 
191
- /**
192
- * Locus Join Response Sent Received
193
- * @returns - latency
194
- */
195
- public getJoinRespSentReceived() {
196
- // TODO: not clear SPARK-440554
197
- return undefined;
198
- }
199
-
200
224
  /**
201
225
  * Time taken to do turn discovery
202
226
  * @returns - latency
@@ -419,6 +443,15 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
419
443
  return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');
420
444
  }
421
445
 
446
+ /**
447
+ * Total latency for all get cluster request.
448
+ */
449
+ public getReachabilityClustersReqResp() {
450
+ const reachablityClusterReqResp = this.precomputedLatencies.get('internal.get.cluster.time');
451
+
452
+ return reachablityClusterReqResp ? Math.floor(reachablityClusterReqResp) : undefined;
453
+ }
454
+
422
455
  /**
423
456
  * Audio setup delay transmit
424
457
  */
@@ -432,4 +465,47 @@ export default class CallDiagnosticLatencies extends WebexPlugin {
432
465
  public getVideoJoinRespTxStart() {
433
466
  return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');
434
467
  }
468
+
469
+ /**
470
+ * Total latency for all exchange ci token.
471
+ */
472
+ public getExchangeCITokenJMT() {
473
+ const exchangeCITokenJMT = this.precomputedLatencies.get('internal.exchange.ci.token.time');
474
+
475
+ return exchangeCITokenJMT ? Math.floor(exchangeCITokenJMT) : undefined;
476
+ }
477
+
478
+ /**
479
+ * Total latency for all refresh captcha requests.
480
+ */
481
+ public getRefreshCaptchaReqResp() {
482
+ const refreshCaptchaReqResp = this.precomputedLatencies.get('internal.refresh.captcha.time');
483
+
484
+ return refreshCaptchaReqResp ? Math.floor(refreshCaptchaReqResp) : undefined;
485
+ }
486
+
487
+ /**
488
+ * Get the latency for downloading intelligence models.
489
+ * @returns - latency
490
+ */
491
+ public getDownloadIntelligenceModelsReqResp() {
492
+ const downloadIntelligenceModelsReqResp = this.precomputedLatencies.get(
493
+ 'internal.api.fetch.intelligence.models'
494
+ );
495
+
496
+ return downloadIntelligenceModelsReqResp
497
+ ? Math.floor(downloadIntelligenceModelsReqResp)
498
+ : undefined;
499
+ }
500
+
501
+ /**
502
+ * Get the total latency for all other app API requests.
503
+ * Excludes meeting info, because it's measured separately.
504
+ * @returns - latency
505
+ */
506
+ public getOtherAppApiReqResp() {
507
+ const otherAppApiJMT = this.precomputedLatencies.get('internal.other.app.api.time');
508
+
509
+ return otherAppApiJMT > 0 ? Math.floor(otherAppApiJMT) : undefined;
510
+ }
435
511
  }
@@ -39,6 +39,7 @@ import {
39
39
  ClientInfo,
40
40
  ClientEventPayloadError,
41
41
  ClientSubServiceType,
42
+ BrowserLaunchMethodType,
42
43
  } from '../metrics.types';
43
44
  import CallDiagnosticEventsBatcher from './call-diagnostic-metrics-batcher';
44
45
  import PreLoginMetricsBatcher from '../prelogin-metrics-batcher';
@@ -65,6 +66,7 @@ type GetOriginOptions = {
65
66
  subClientType: SubClientType;
66
67
  networkType?: NetworkType;
67
68
  clientLaunchMethod?: ClientLaunchMethodType;
69
+ browserLaunchMethod?: BrowserLaunchMethodType;
68
70
  environment?: EnvironmentType;
69
71
  newEnvironment?: NewEnvironmentType;
70
72
  };
@@ -258,6 +260,10 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
258
260
  origin.clientInfo.clientLaunchMethod = options.clientLaunchMethod;
259
261
  }
260
262
 
263
+ if (options?.browserLaunchMethod) {
264
+ origin.clientInfo.browserLaunchMethod = options.browserLaunchMethod;
265
+ }
266
+
261
267
  return origin;
262
268
  }
263
269
 
@@ -293,11 +299,17 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
293
299
  if (this.webex.internal) {
294
300
  // @ts-ignore
295
301
  const {device} = this.webex.internal;
302
+ const {installationId} = device.config || {};
303
+
296
304
  identifiers.userId = device.userId || preLoginId;
297
305
  identifiers.deviceId = device.url;
298
306
  identifiers.orgId = device.orgId;
299
307
  // @ts-ignore
300
308
  identifiers.locusUrl = this.webex.internal.services.get('locus');
309
+
310
+ if (installationId) {
311
+ identifiers.machineId = installationId;
312
+ }
301
313
  }
302
314
 
303
315
  if (meeting?.locusInfo?.fullState) {
@@ -607,6 +619,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
607
619
  return this.getErrorPayloadForClientErrorCode({
608
620
  clientErrorCode: UNKNOWN_ERROR,
609
621
  serviceErrorCode: UNKNOWN_ERROR,
622
+ payloadOverrides: rawError.payloadOverrides,
610
623
  rawErrorMessage,
611
624
  httpStatusCode,
612
625
  });
@@ -244,22 +244,29 @@ export const prepareDiagnosticMetricItem = (webex: any, item: any) => {
244
244
  case 'client.webexapp.launched':
245
245
  joinTimes.downloadTime = cdl.getDownloadTimeJMT();
246
246
  break;
247
+ case 'client.login.end':
248
+ joinTimes.otherAppApiReqResp = cdl.getOtherAppApiReqResp();
249
+ joinTimes.exchangeCITokenJMT = cdl.getExchangeCITokenJMT();
250
+ break;
247
251
  case 'client.interstitial-window.launched':
248
252
  joinTimes.meetingInfoReqResp = cdl.getMeetingInfoReqResp();
249
253
  joinTimes.clickToInterstitial = cdl.getClickToInterstitial();
254
+ joinTimes.refreshCaptchaServiceReqResp = cdl.getRefreshCaptchaReqResp();
255
+ joinTimes.downloadIntelligenceModelsReqResp = cdl.getDownloadIntelligenceModelsReqResp();
250
256
  break;
251
257
 
252
258
  case 'client.call.initiated':
253
259
  joinTimes.meetingInfoReqResp = cdl.getMeetingInfoReqResp();
254
260
  joinTimes.showInterstitialTime = cdl.getShowInterstitialTime();
255
261
  joinTimes.registerWDMDeviceJMT = cdl.getRegisterWDMDeviceJMT();
262
+ joinTimes.getU2CTime = cdl.getU2CTime();
263
+ joinTimes.getReachabilityClustersReqResp = cdl.getReachabilityClustersReqResp();
256
264
  break;
257
265
 
258
266
  case 'client.locus.join.response':
259
267
  joinTimes.meetingInfoReqResp = cdl.getMeetingInfoReqResp();
260
268
  joinTimes.callInitJoinReq = cdl.getCallInitJoinReq();
261
269
  joinTimes.joinReqResp = cdl.getJoinReqResp();
262
- joinTimes.joinReqSentReceived = cdl.getJoinRespSentReceived();
263
270
  joinTimes.pageJmt = cdl.getPageJMT();
264
271
  joinTimes.clickToInterstitial = cdl.getClickToInterstitial();
265
272
  joinTimes.interstitialToJoinOK = cdl.getInterstitialToJoinOK();
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  SubmitInternalEvent,
19
19
  SubmitOperationalEvent,
20
20
  SubmitMQE,
21
+ PreComputedLatencies,
21
22
  } from './metrics.types';
22
23
  import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
23
24
  import * as CallDiagnosticUtils from './call-diagnostic/call-diagnostic-metrics.util';
@@ -51,4 +52,5 @@ export type {
51
52
  SubmitInternalEvent,
52
53
  SubmitMQE,
53
54
  SubmitOperationalEvent,
55
+ PreComputedLatencies,
54
56
  };
package/src/metrics.js CHANGED
@@ -56,11 +56,14 @@ const Metrics = WebexPlugin.extend({
56
56
  throw Error('Missing behavioral metric name. Please provide one');
57
57
  }
58
58
  const payload = {metricName: eventName};
59
+ // @ts-ignore
60
+ const providedClientVersion = this.webex.meetings?.config?.metrics?.clientVersion;
59
61
 
60
62
  payload.tags = {
61
63
  ...props.tags,
62
64
  browser: getBrowserName(),
63
65
  os: getOSNameInternal(),
66
+ appVersion: providedClientVersion,
64
67
 
65
68
  // Node does not like this so we need to check if it exists or not
66
69
  // eslint-disable-next-line no-undef