@webex/internal-plugin-metrics 3.0.0-beta.22 → 3.0.0-beta.220

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 (67) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +56 -0
  2. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
  3. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +451 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +645 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
  7. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +276 -0
  8. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
  9. package/dist/call-diagnostic/config.js +580 -0
  10. package/dist/call-diagnostic/config.js.map +1 -0
  11. package/dist/call-diagnostic/generated-types-temp/ClientEvent.js +7 -0
  12. package/dist/call-diagnostic/generated-types-temp/ClientEvent.js.map +1 -0
  13. package/dist/call-diagnostic/generated-types-temp/Event.js +7 -0
  14. package/dist/call-diagnostic/generated-types-temp/Event.js.map +1 -0
  15. package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js +7 -0
  16. package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js.map +1 -0
  17. package/dist/config.js +20 -1
  18. package/dist/config.js.map +1 -1
  19. package/dist/index.js +25 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/metrics.js +30 -30
  22. package/dist/metrics.js.map +1 -1
  23. package/dist/metrics.types.js +7 -0
  24. package/dist/metrics.types.js.map +1 -0
  25. package/dist/new-metrics.js +249 -0
  26. package/dist/new-metrics.js.map +1 -0
  27. package/dist/types/batcher.d.ts +2 -0
  28. package/dist/types/call-diagnostic/call-diagnostic-metrics-batcher.d.ts +2 -0
  29. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +189 -0
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +356 -0
  31. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +73 -0
  32. package/dist/types/call-diagnostic/config.d.ts +86 -0
  33. package/dist/types/call-diagnostic/generated-types-temp/ClientEvent.d.ts +1112 -0
  34. package/dist/types/call-diagnostic/generated-types-temp/Event.d.ts +4851 -0
  35. package/dist/types/call-diagnostic/generated-types-temp/MediaQualityEvent.d.ts +2121 -0
  36. package/dist/types/client-metrics-batcher.d.ts +2 -0
  37. package/dist/types/config.d.ts +35 -0
  38. package/dist/types/index.d.ts +11 -0
  39. package/dist/types/metrics.d.ts +3 -0
  40. package/dist/types/metrics.types.d.ts +95 -0
  41. package/dist/types/new-metrics.d.ts +119 -0
  42. package/package.json +12 -8
  43. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +51 -0
  44. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +408 -0
  45. package/src/call-diagnostic/call-diagnostic-metrics.ts +655 -0
  46. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +280 -0
  47. package/src/call-diagnostic/config.ts +578 -0
  48. package/src/call-diagnostic/generated-types-temp/ClientEvent.ts +2395 -0
  49. package/src/call-diagnostic/generated-types-temp/Event.ts +7762 -0
  50. package/src/call-diagnostic/generated-types-temp/MediaQualityEvent.ts +2321 -0
  51. package/src/config.js +19 -0
  52. package/src/index.ts +41 -0
  53. package/src/metrics.js +25 -27
  54. package/src/metrics.types.ts +140 -0
  55. package/src/new-metrics.ts +223 -0
  56. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +243 -0
  57. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +474 -0
  58. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +1015 -0
  59. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +454 -0
  60. package/test/unit/spec/metrics.js +65 -97
  61. package/test/unit/spec/new-metrics.ts +155 -0
  62. package/tsconfig.json +6 -0
  63. package/dist/call-diagnostic-events-batcher.js +0 -60
  64. package/dist/call-diagnostic-events-batcher.js.map +0 -1
  65. package/src/call-diagnostic-events-batcher.js +0 -62
  66. package/src/index.js +0 -17
  67. package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
package/src/config.js CHANGED
@@ -21,3 +21,22 @@ export default {
21
21
  batcherRetryPlateau: 32000,
22
22
  },
23
23
  };
24
+
25
+ export const OS_NAME = {
26
+ WINDOWS: 'windows',
27
+ MAC: 'mac',
28
+ IOS: 'ios',
29
+ ANDROID: 'android',
30
+ CHROME: 'chrome',
31
+ LINUX: 'linux',
32
+ OTHERS: 'other',
33
+ };
34
+
35
+ export const OSMap = {
36
+ 'Chrome OS': OS_NAME.CHROME,
37
+ macOS: OS_NAME.MAC,
38
+ Windows: OS_NAME.WINDOWS,
39
+ iOS: OS_NAME.IOS,
40
+ Android: OS_NAME.ANDROID,
41
+ Linux: OS_NAME.LINUX,
42
+ };
package/src/index.ts ADDED
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import '@webex/internal-plugin-device';
6
+
7
+ import {registerInternalPlugin} from '@webex/webex-core';
8
+
9
+ import Metrics from './metrics';
10
+ import config from './config';
11
+ import NewMetrics from './new-metrics';
12
+ import {
13
+ ClientEvent,
14
+ ClientEventLeaveReason,
15
+ SubmitBehavioralEvent,
16
+ SubmitClientEvent,
17
+ SubmitInternalEvent,
18
+ SubmitOperationalEvent,
19
+ SubmitMQE,
20
+ } from './metrics.types';
21
+ import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
22
+
23
+ registerInternalPlugin('metrics', Metrics, {
24
+ config,
25
+ });
26
+
27
+ registerInternalPlugin('newMetrics', NewMetrics, {
28
+ config,
29
+ });
30
+
31
+ export {default, getOSNameInternal} from './metrics';
32
+ export {config, CALL_DIAGNOSTIC_CONFIG, NewMetrics};
33
+ export type {
34
+ ClientEvent,
35
+ ClientEventLeaveReason,
36
+ SubmitBehavioralEvent,
37
+ SubmitClientEvent,
38
+ SubmitInternalEvent,
39
+ SubmitMQE,
40
+ SubmitOperationalEvent,
41
+ };
package/src/metrics.js CHANGED
@@ -6,14 +6,17 @@
6
6
 
7
7
  import {WebexPlugin} from '@webex/webex-core';
8
8
  import {BrowserDetection} from '@webex/common';
9
+ import {OS_NAME, OSMap, CLIENT_NAME} from './config';
9
10
 
10
- import {CLIENT_NAME} from './config';
11
11
  import Batcher from './batcher';
12
12
  import ClientMetricsBatcher from './client-metrics-batcher';
13
- import CallDiagnosticEventsBatcher from './call-diagnostic-events-batcher';
14
13
 
15
14
  const {getOSName, getOSVersion, getBrowserName, getBrowserVersion} = BrowserDetection();
16
15
 
16
+ export function getOSNameInternal() {
17
+ return OSMap[getOSName()] ?? OS_NAME.OTHERS;
18
+ }
19
+
17
20
  function getSparkUserAgent(webex) {
18
21
  const {appName, appVersion, appPlatform} = webex?.config ?? {};
19
22
 
@@ -34,7 +37,6 @@ const Metrics = WebexPlugin.extend({
34
37
  children: {
35
38
  batcher: Batcher,
36
39
  clientMetricsBatcher: ClientMetricsBatcher,
37
- callDiagnosticEventsBatcher: CallDiagnosticEventsBatcher,
38
40
  },
39
41
 
40
42
  namespace: 'Metrics',
@@ -44,13 +46,12 @@ const Metrics = WebexPlugin.extend({
44
46
  },
45
47
 
46
48
  /**
47
- * This corresponds to #sendSemiStructured() in the deprecated metrics handler
49
+ * Returns the payload for submitting client metrics.
48
50
  * @param {string} eventName
49
- * @param {Object} props
50
- * @param {string} preLoginId
51
- * @returns {Object} HttpResponse object
51
+ * @param {any} props
52
+ * @returns {any} - the payload
52
53
  */
53
- submitClientMetrics(eventName, props = {}, preLoginId) {
54
+ getClientMetricsPayload(eventName, props) {
54
55
  if (!eventName) {
55
56
  throw Error('Missing behavioral metric name. Please provide one');
56
57
  }
@@ -59,22 +60,14 @@ const Metrics = WebexPlugin.extend({
59
60
  payload.tags = {
60
61
  ...props.tags,
61
62
  browser: getBrowserName(),
62
- os: getOSName(),
63
+ os: getOSNameInternal(),
63
64
 
64
65
  // Node does not like this so we need to check if it exists or not
65
66
  // eslint-disable-next-line no-undef
66
67
  domain:
67
68
  typeof window !== 'undefined' ? window.location.hostname || 'non-browser' : 'non-browser', // Check what else we could measure
68
- client_id: this.webex.credentials.config.client_id,
69
- user_id: this.webex.internal.device.userId,
70
69
  };
71
70
 
72
- try {
73
- payload.tags.org_id = this.webex.credentials.getOrgId();
74
- } catch {
75
- this.logger.info('metrics: unable to get orgId');
76
- }
77
-
78
71
  payload.fields = {
79
72
  ...props.fields,
80
73
  browser_version: getBrowserVersion(),
@@ -82,6 +75,7 @@ const Metrics = WebexPlugin.extend({
82
75
  sdk_version: this.webex.version,
83
76
  platform: 'Web',
84
77
  spark_user_agent: getSparkUserAgent(this.webex),
78
+ client_id: this.webex.credentials.config.client_id,
85
79
  };
86
80
 
87
81
  payload.type = props.type || this.webex.config.metrics.type;
@@ -93,7 +87,7 @@ const Metrics = WebexPlugin.extend({
93
87
  },
94
88
  locale: 'en-US',
95
89
  os: {
96
- name: getOSName(),
90
+ name: getOSNameInternal(),
97
91
  version: getOSVersion(),
98
92
  },
99
93
  };
@@ -106,6 +100,19 @@ const Metrics = WebexPlugin.extend({
106
100
  // is impossible so unable to use Date.now()
107
101
  payload.timestamp = new Date().valueOf();
108
102
 
103
+ return payload;
104
+ },
105
+
106
+ /**
107
+ * This corresponds to #sendSemiStructured() in the deprecated metrics handler
108
+ * @param {string} eventName
109
+ * @param {Object} props
110
+ * @param {string} preLoginId
111
+ * @returns {Object} HttpResponse object
112
+ */
113
+ submitClientMetrics(eventName, props = {}, preLoginId) {
114
+ const payload = this.getClientMetricsPayload(eventName, props);
115
+
109
116
  if (preLoginId) {
110
117
  const _payload = {
111
118
  metrics: [payload],
@@ -154,15 +161,6 @@ const Metrics = WebexPlugin.extend({
154
161
  })
155
162
  );
156
163
  },
157
-
158
- submitCallDiagnosticEvents(payload) {
159
- const event = {
160
- type: 'diagnostic-event',
161
- eventPayload: payload,
162
- };
163
-
164
- return this.callDiagnosticEventsBatcher.request(event);
165
- },
166
164
  });
167
165
 
168
166
  export default Metrics;
@@ -0,0 +1,140 @@
1
+ import {ClientEvent as RawClientEvent} from './call-diagnostic/generated-types-temp/ClientEvent';
2
+ import {Event as RawEvent} from './call-diagnostic/generated-types-temp/Event';
3
+ import {MediaQualityEvent as RawMediaQualityEvent} from './call-diagnostic/generated-types-temp/MediaQualityEvent';
4
+
5
+ export type Event = Omit<RawEvent, 'event'> & {event: RawClientEvent | RawMediaQualityEvent};
6
+
7
+ export type ClientEventError = NonNullable<RawClientEvent['errors']>[0];
8
+
9
+ export type SubmitClientEventOptions = {
10
+ meetingId?: string;
11
+ mediaConnections?: any[];
12
+ rawError?: any;
13
+ showToUser?: boolean;
14
+ correlationId?: string;
15
+ };
16
+
17
+ export type SubmitMQEOptions = {
18
+ meetingId: string;
19
+ mediaConnections?: any[];
20
+ networkType?: Event['origin']['networkType'];
21
+ };
22
+
23
+ export type InternalEvent = {
24
+ name:
25
+ | 'internal.client.meetinginfo.request'
26
+ | 'internal.client.meetinginfo.response'
27
+ | 'internal.reset.join.latencies'
28
+ | 'internal.client.interstitial-window.launched'
29
+ | 'internal.client.meeting.click.joinbutton'
30
+ | 'internal.host.meeting.participant.admitted'
31
+ | 'internal.client.meeting.interstitial-window.showed'
32
+ | 'internal.client.interstitial-window.click.joinbutton';
33
+ payload?: never;
34
+ options?: never;
35
+ };
36
+
37
+ export interface ClientEvent {
38
+ name: RawClientEvent['name'];
39
+ payload?: RawClientEvent;
40
+ options?: SubmitClientEventOptions;
41
+ }
42
+
43
+ export interface BehavioralEvent {
44
+ // TODO: not implemented
45
+ name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';
46
+ payload?: never;
47
+ options?: never;
48
+ }
49
+
50
+ export interface OperationalEvent {
51
+ // TODO: not implemented
52
+ name: never;
53
+ payload?: never;
54
+ options?: never;
55
+ }
56
+
57
+ export interface FeatureEvent {
58
+ // TODO: not implemented
59
+ name: never;
60
+ payload?: never;
61
+ options?: never;
62
+ }
63
+
64
+ export interface MediaQualityEvent {
65
+ name: RawMediaQualityEvent['name'];
66
+ payload?: RawMediaQualityEvent;
67
+ options: SubmitMQEOptions;
68
+ }
69
+
70
+ export type RecursivePartial<T> = {
71
+ [P in keyof T]?: T[P] extends (infer U)[]
72
+ ? RecursivePartial<U>[]
73
+ : T[P] extends object
74
+ ? RecursivePartial<T[P]>
75
+ : T[P];
76
+ };
77
+
78
+ export type MetricEventNames =
79
+ | InternalEvent['name']
80
+ | ClientEvent['name']
81
+ | BehavioralEvent['name']
82
+ | OperationalEvent['name']
83
+ | FeatureEvent['name']
84
+ | MediaQualityEvent['name'];
85
+
86
+ export type ClientInfo = NonNullable<RawEvent['origin']['clientInfo']>;
87
+ export type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];
88
+ export type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];
89
+ export type NetworkType = NonNullable<RawEvent['origin']>['networkType'];
90
+
91
+ export type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;
92
+ export type ClientEventLeaveReason = ClientEvent['payload']['leaveReason'];
93
+ export type ClientEventPayloadError = ClientEvent['payload']['errors'];
94
+
95
+ export type MediaQualityEventAudioSetupDelayPayload = NonNullable<
96
+ MediaQualityEvent['payload']
97
+ >['audioSetupDelay'];
98
+ export type MediaQualityEventVideoSetupDelayPayload = NonNullable<
99
+ MediaQualityEvent['payload']
100
+ >['videoSetupDelay'];
101
+
102
+ export type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {
103
+ intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];
104
+ };
105
+
106
+ export type SubmitInternalEvent = (args: {
107
+ name: InternalEvent['name'];
108
+ payload?: RecursivePartial<InternalEvent['payload']>;
109
+ options?: any;
110
+ }) => void;
111
+
112
+ export type SubmitBehavioralEvent = (args: {
113
+ name: BehavioralEvent['name'];
114
+ payload?: RecursivePartial<BehavioralEvent['payload']>;
115
+ options?: any;
116
+ }) => void;
117
+
118
+ export type SubmitClientEvent = (args: {
119
+ name: ClientEvent['name'];
120
+ payload?: RecursivePartial<ClientEvent['payload']>;
121
+ options?: SubmitClientEventOptions;
122
+ }) => Promise<any>;
123
+
124
+ export type SubmitOperationalEvent = (args: {
125
+ name: OperationalEvent['name'];
126
+ payload?: RecursivePartial<OperationalEvent['payload']>;
127
+ options?: any;
128
+ }) => void;
129
+
130
+ export type SubmitMQE = (args: {
131
+ name: MediaQualityEvent['name'];
132
+ payload: SubmitMQEPayload;
133
+ options: any;
134
+ }) => void;
135
+
136
+ export type BuildClientEventFetchRequestOptions = (args: {
137
+ name: ClientEvent['name'];
138
+ payload?: RecursivePartial<ClientEvent['payload']>;
139
+ options?: SubmitClientEventOptions;
140
+ }) => Promise<any>;
@@ -0,0 +1,223 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable class-methods-use-this */
3
+ /* eslint-disable valid-jsdoc */
4
+
5
+ // @ts-ignore
6
+ import {WebexPlugin} from '@webex/webex-core';
7
+
8
+ import CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';
9
+ import {
10
+ RecursivePartial,
11
+ ClientEvent,
12
+ FeatureEvent,
13
+ BehavioralEvent,
14
+ OperationalEvent,
15
+ MediaQualityEvent,
16
+ InternalEvent,
17
+ SubmitClientEventOptions,
18
+ } from './metrics.types';
19
+ import CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';
20
+ import {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';
21
+
22
+ /**
23
+ * Metrics plugin to centralize all types of metrics.
24
+ * @class
25
+ */
26
+ class Metrics extends WebexPlugin {
27
+ // eslint-disable-next-line no-use-before-define
28
+ static instance: Metrics;
29
+
30
+ // Call Diagnostic latencies
31
+ callDiagnosticLatencies: CallDiagnosticLatencies;
32
+ // Helper classes to handle the different types of metrics
33
+ callDiagnosticMetrics: CallDiagnosticMetrics;
34
+
35
+ /**
36
+ * Constructor
37
+ * @param args
38
+ * @constructor
39
+ * @private
40
+ * @returns
41
+ */
42
+ constructor(...args) {
43
+ super(...args);
44
+
45
+ this.onReady();
46
+ }
47
+
48
+ /**
49
+ * On Ready
50
+ */
51
+ private onReady() {
52
+ // @ts-ignore
53
+ this.webex.once('ready', () => {
54
+ // @ts-ignore
55
+ this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});
56
+ // @ts-ignore
57
+ this.callDiagnosticLatencies = new CallDiagnosticLatencies({}, {parent: this.webex});
58
+ });
59
+ }
60
+
61
+ /**
62
+ * Used for internal purposes only
63
+ * @param args
64
+ */
65
+ submitInternalEvent({
66
+ name,
67
+ payload,
68
+ options,
69
+ }: {
70
+ name: InternalEvent['name'];
71
+ payload?: RecursivePartial<InternalEvent['payload']>;
72
+ options?: any;
73
+ }) {
74
+ if (name === 'internal.reset.join.latencies') {
75
+ this.callDiagnosticLatencies.clearTimestamps();
76
+ } else {
77
+ this.callDiagnosticLatencies.saveTimestamp({key: name});
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Behavioral event
83
+ * @param args
84
+ */
85
+ submitBehavioralEvent({
86
+ name,
87
+ payload,
88
+ options,
89
+ }: {
90
+ name: BehavioralEvent['name'];
91
+ payload?: RecursivePartial<BehavioralEvent['payload']>;
92
+ options?: any;
93
+ }) {
94
+ this.callDiagnosticLatencies.saveTimestamp({key: name});
95
+ throw new Error('Not implemented.');
96
+ }
97
+
98
+ /**
99
+ * Operational event
100
+ * @param args
101
+ */
102
+ submitOperationalEvent({
103
+ name,
104
+ payload,
105
+ options,
106
+ }: {
107
+ name: OperationalEvent['name'];
108
+ payload?: RecursivePartial<OperationalEvent['payload']>;
109
+ options?: any;
110
+ }) {
111
+ throw new Error('Not implemented.');
112
+ }
113
+
114
+ /**
115
+ * Call Analyzer: Media Quality Event
116
+ * @param args
117
+ */
118
+ submitMQE({
119
+ name,
120
+ payload,
121
+ options,
122
+ }: {
123
+ name: MediaQualityEvent['name'];
124
+ payload: RecursivePartial<MediaQualityEvent['payload']> & {
125
+ intervals: MediaQualityEvent['payload']['intervals'];
126
+ };
127
+ options: any;
128
+ }) {
129
+ this.callDiagnosticLatencies.saveTimestamp({key: name});
130
+ this.callDiagnosticMetrics.submitMQE({name, payload, options});
131
+ }
132
+
133
+ /**
134
+ * Call Analyzer: Feature Usage Event
135
+ * @param args
136
+ */
137
+ submitFeatureEvent({
138
+ name,
139
+ payload,
140
+ options,
141
+ }: {
142
+ name: FeatureEvent['name'];
143
+ payload?: RecursivePartial<FeatureEvent['payload']>;
144
+ options: any;
145
+ }) {
146
+ throw new Error('Not implemented.');
147
+ }
148
+
149
+ /**
150
+ * Call Analyzer: Client Event
151
+ * @public
152
+ * @param args
153
+ */
154
+ public submitClientEvent({
155
+ name,
156
+ payload,
157
+ options,
158
+ }: {
159
+ name: ClientEvent['name'];
160
+ payload?: RecursivePartial<ClientEvent['payload']>;
161
+ options?: SubmitClientEventOptions;
162
+ }): Promise<any> {
163
+ this.callDiagnosticLatencies.saveTimestamp({
164
+ key: name,
165
+ options: {meetingId: options?.meetingId},
166
+ });
167
+
168
+ return this.callDiagnosticMetrics.submitClientEvent({name, payload, options});
169
+ }
170
+
171
+ /**
172
+ * Returns a promise that will resolve to fetch options for submitting a metric.
173
+ *
174
+ * This is to support quickly submitting metrics when the browser/tab is closing.
175
+ * Calling submitClientEvent will not work because there some async steps that will
176
+ * not complete before the browser is closed. Instead, we pre-gather all the
177
+ * information/options needed for the request(s), and then simply and quickly
178
+ * fire the fetch(es) when beforeUnload is triggered.
179
+ *
180
+ * We must use fetch instead of request because fetch has a keepalive option that
181
+ * allows the request it to outlive the page.
182
+ *
183
+ * Note: the timings values will be wrong, but setMetricTimingsAndFetch() will
184
+ * properly adjust them before submitting.
185
+ *
186
+ * @public
187
+ * @param {Object} arg
188
+ * @param {String} arg.name - event name
189
+ * @param {Object} arg.payload - event payload
190
+ * @param {Object} arg.options - other options
191
+ * @returns {Promise} promise that resolves to options to be used with fetch
192
+ */
193
+ public async buildClientEventFetchRequestOptions({
194
+ name,
195
+ payload,
196
+ options,
197
+ }: {
198
+ name: ClientEvent['name'];
199
+ payload?: RecursivePartial<ClientEvent['payload']>;
200
+ options?: SubmitClientEventOptions;
201
+ }): Promise<any> {
202
+ return this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({
203
+ name,
204
+ payload,
205
+ options,
206
+ });
207
+ }
208
+
209
+ /**
210
+ * Submits a metric from pre-built request options via the fetch API. Updates
211
+ * the "$timings" and "originTime" values to Date.now() since the existing times
212
+ * were set when the options were built (not submitted).
213
+
214
+ * @param {any} options - the pre-built request options for submitting a metric
215
+ * @returns {Promise} promise that resolves to the response object
216
+ */
217
+ public setMetricTimingsAndFetch(options: any): Promise<any> {
218
+ // @ts-ignore
219
+ return this.webex.setTimingsAndFetch(setMetricTimings(options));
220
+ }
221
+ }
222
+
223
+ export default Metrics;