@webex/internal-plugin-metrics 3.0.0-beta.40 → 3.0.0-beta.400

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 (73) hide show
  1. package/dist/batcher.js +40 -1
  2. package/dist/batcher.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +65 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +508 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
  7. package/dist/call-diagnostic/call-diagnostic-metrics.js +860 -0
  8. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
  9. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +367 -0
  10. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
  11. package/dist/call-diagnostic/config.js +627 -0
  12. package/dist/call-diagnostic/config.js.map +1 -0
  13. package/dist/client-metrics-batcher.js +2 -1
  14. package/dist/client-metrics-batcher.js.map +1 -1
  15. package/dist/config.js +2 -1
  16. package/dist/config.js.map +1 -1
  17. package/dist/index.js +33 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/metrics.js +27 -28
  20. package/dist/metrics.js.map +1 -1
  21. package/dist/metrics.types.js +7 -0
  22. package/dist/metrics.types.js.map +1 -0
  23. package/dist/new-metrics.js +300 -0
  24. package/dist/new-metrics.js.map +1 -0
  25. package/dist/prelogin-metrics-batcher.js +82 -0
  26. package/dist/prelogin-metrics-batcher.js.map +1 -0
  27. package/dist/types/batcher.d.ts +7 -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 +218 -0
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +421 -0
  31. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +103 -0
  32. package/dist/types/call-diagnostic/config.d.ts +178 -0
  33. package/dist/types/client-metrics-batcher.d.ts +2 -0
  34. package/dist/types/config.d.ts +36 -0
  35. package/dist/types/index.d.ts +15 -0
  36. package/dist/types/metrics.d.ts +3 -0
  37. package/dist/types/metrics.types.d.ts +105 -0
  38. package/dist/types/new-metrics.d.ts +131 -0
  39. package/dist/types/prelogin-metrics-batcher.d.ts +2 -0
  40. package/dist/types/utils.d.ts +6 -0
  41. package/dist/utils.js +27 -0
  42. package/dist/utils.js.map +1 -0
  43. package/package.json +16 -8
  44. package/src/batcher.js +38 -0
  45. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +72 -0
  46. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +467 -0
  47. package/src/call-diagnostic/call-diagnostic-metrics.ts +919 -0
  48. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +395 -0
  49. package/src/call-diagnostic/config.ts +685 -0
  50. package/src/client-metrics-batcher.js +1 -0
  51. package/src/config.js +1 -0
  52. package/src/index.ts +56 -0
  53. package/src/metrics.js +21 -24
  54. package/src/metrics.types.ts +170 -0
  55. package/src/new-metrics.ts +278 -0
  56. package/src/prelogin-metrics-batcher.ts +95 -0
  57. package/src/utils.ts +17 -0
  58. package/test/unit/spec/batcher.js +2 -0
  59. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +457 -0
  60. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +657 -0
  61. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +2303 -0
  62. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +634 -0
  63. package/test/unit/spec/client-metrics-batcher.js +2 -0
  64. package/test/unit/spec/metrics.js +74 -97
  65. package/test/unit/spec/new-metrics.ts +231 -0
  66. package/test/unit/spec/prelogin-metrics-batcher.ts +250 -0
  67. package/test/unit/spec/utils.ts +22 -0
  68. package/tsconfig.json +6 -0
  69. package/dist/call-diagnostic-events-batcher.js +0 -60
  70. package/dist/call-diagnostic-events-batcher.js.map +0 -1
  71. package/src/call-diagnostic-events-batcher.js +0 -62
  72. package/src/index.js +0 -17
  73. package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
+ _Object$defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = void 0;
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
11
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
13
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
15
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
17
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
19
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
20
+ var _webexCore = require("@webex/webex-core");
21
+ var _callDiagnosticMetrics = _interopRequireDefault(require("./call-diagnostic/call-diagnostic-metrics"));
22
+ var _callDiagnosticMetricsLatencies = _interopRequireDefault(require("./call-diagnostic/call-diagnostic-metrics-latencies"));
23
+ var _callDiagnosticMetrics2 = require("./call-diagnostic/call-diagnostic-metrics.util");
24
+ var _utils = require("./utils");
25
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
26
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
+ /**
28
+ * Metrics plugin to centralize all types of metrics.
29
+ * @class
30
+ */
31
+ var Metrics = /*#__PURE__*/function (_WebexPlugin) {
32
+ (0, _inherits2.default)(Metrics, _WebexPlugin);
33
+ var _super = _createSuper(Metrics);
34
+ // eslint-disable-next-line no-use-before-define
35
+
36
+ // Call Diagnostic latencies
37
+
38
+ // Helper classes to handle the different types of metrics
39
+
40
+ /**
41
+ * Constructor
42
+ * @param args
43
+ * @constructor
44
+ * @private
45
+ * @returns
46
+ */
47
+ function Metrics() {
48
+ var _this;
49
+ (0, _classCallCheck2.default)(this, Metrics);
50
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+ _this = _super.call.apply(_super, [this].concat(args));
54
+
55
+ // @ts-ignore
56
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticLatencies", void 0);
57
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticMetrics", void 0);
58
+ _this.callDiagnosticLatencies = new _callDiagnosticMetricsLatencies.default({}, {
59
+ parent: _this.webex
60
+ });
61
+ _this.onReady();
62
+ return _this;
63
+ }
64
+
65
+ /**
66
+ * On Ready
67
+ */
68
+ (0, _createClass2.default)(Metrics, [{
69
+ key: "onReady",
70
+ value: function onReady() {
71
+ var _this2 = this;
72
+ // @ts-ignore
73
+ this.webex.once('ready', function () {
74
+ // @ts-ignore
75
+ _this2.callDiagnosticMetrics = new _callDiagnosticMetrics.default({}, {
76
+ parent: _this2.webex
77
+ });
78
+ });
79
+ }
80
+
81
+ /**
82
+ * Used for internal purposes only
83
+ * @param args
84
+ */
85
+ }, {
86
+ key: "submitInternalEvent",
87
+ value: function submitInternalEvent(_ref) {
88
+ var name = _ref.name,
89
+ payload = _ref.payload,
90
+ options = _ref.options;
91
+ if (name === 'internal.reset.join.latencies') {
92
+ this.callDiagnosticLatencies.clearTimestamps();
93
+ } else {
94
+ this.callDiagnosticLatencies.saveTimestamp({
95
+ key: name
96
+ });
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Behavioral event
102
+ * @param args
103
+ */
104
+ }, {
105
+ key: "submitBehavioralEvent",
106
+ value: function submitBehavioralEvent(_ref2) {
107
+ var name = _ref2.name,
108
+ payload = _ref2.payload,
109
+ options = _ref2.options;
110
+ this.callDiagnosticLatencies.saveTimestamp({
111
+ key: name
112
+ });
113
+ throw new Error('Not implemented.');
114
+ }
115
+
116
+ /**
117
+ * Operational event
118
+ * @param args
119
+ */
120
+ }, {
121
+ key: "submitOperationalEvent",
122
+ value: function submitOperationalEvent(_ref3) {
123
+ var name = _ref3.name,
124
+ payload = _ref3.payload,
125
+ options = _ref3.options;
126
+ throw new Error('Not implemented.');
127
+ }
128
+
129
+ /**
130
+ * Call Analyzer: Media Quality Event
131
+ * @param args
132
+ */
133
+ }, {
134
+ key: "submitMQE",
135
+ value: function submitMQE(_ref4) {
136
+ var name = _ref4.name,
137
+ payload = _ref4.payload,
138
+ options = _ref4.options;
139
+ this.callDiagnosticLatencies.saveTimestamp({
140
+ key: name
141
+ });
142
+ this.callDiagnosticMetrics.submitMQE({
143
+ name: name,
144
+ payload: payload,
145
+ options: options
146
+ });
147
+ }
148
+
149
+ /**
150
+ * Call Analyzer: Feature Usage Event
151
+ * @param args
152
+ */
153
+ }, {
154
+ key: "submitFeatureEvent",
155
+ value: function submitFeatureEvent(_ref5) {
156
+ var name = _ref5.name,
157
+ payload = _ref5.payload,
158
+ options = _ref5.options;
159
+ throw new Error('Not implemented.');
160
+ }
161
+
162
+ /**
163
+ * Call Analyzer: Client Event
164
+ * @public
165
+ * @param args
166
+ */
167
+ }, {
168
+ key: "submitClientEvent",
169
+ value: function submitClientEvent(_ref6) {
170
+ var name = _ref6.name,
171
+ payload = _ref6.payload,
172
+ options = _ref6.options;
173
+ if (!this.callDiagnosticLatencies || !this.callDiagnosticMetrics) {
174
+ // @ts-ignore
175
+ this.webex.logger.log("NewMetrics: @submitClientEvent. Attempted to submit before webex.ready. Event name: ".concat(name));
176
+ return _promise.default.resolve();
177
+ }
178
+ this.callDiagnosticLatencies.saveTimestamp({
179
+ key: name,
180
+ options: {
181
+ meetingId: options === null || options === void 0 ? void 0 : options.meetingId
182
+ }
183
+ });
184
+ return this.callDiagnosticMetrics.submitClientEvent({
185
+ name: name,
186
+ payload: payload,
187
+ options: options
188
+ });
189
+ }
190
+
191
+ /**
192
+ * Issue request to alias a user's pre-login ID with their CI UUID
193
+ * @param {string} preLoginId
194
+ * @returns {Object} HttpResponse object
195
+ */
196
+ }, {
197
+ key: "clientMetricsAliasUser",
198
+ value: function clientMetricsAliasUser(preLoginId) {
199
+ var _this3 = this;
200
+ // @ts-ignore
201
+ return this.webex.request({
202
+ method: 'POST',
203
+ api: 'metrics',
204
+ resource: 'clientmetrics',
205
+ headers: {
206
+ 'x-prelogin-userid': preLoginId
207
+ },
208
+ body: {},
209
+ qs: {
210
+ alias: true
211
+ }
212
+ }).then(function (res) {
213
+ // @ts-ignore
214
+ _this3.webex.logger.log("NewMetrics: @clientMetricsAliasUser. Request successful.");
215
+ return res;
216
+ }).catch(function (err) {
217
+ // @ts-ignore
218
+ _this3.logger.error("NewMetrics: @clientMetricsAliasUser. Request failed:", "err: ".concat((0, _utils.generateCommonErrorMetadata)(err)));
219
+ return _promise.default.reject(err);
220
+ });
221
+ }
222
+
223
+ /**
224
+ * Returns a promise that will resolve to fetch options for submitting a metric.
225
+ *
226
+ * This is to support quickly submitting metrics when the browser/tab is closing.
227
+ * Calling submitClientEvent will not work because there some async steps that will
228
+ * not complete before the browser is closed. Instead, we pre-gather all the
229
+ * information/options needed for the request(s), and then simply and quickly
230
+ * fire the fetch(es) when beforeUnload is triggered.
231
+ *
232
+ * We must use fetch instead of request because fetch has a keepalive option that
233
+ * allows the request it to outlive the page.
234
+ *
235
+ * Note: the timings values will be wrong, but setMetricTimingsAndFetch() will
236
+ * properly adjust them before submitting.
237
+ *
238
+ * @public
239
+ * @param {Object} arg
240
+ * @param {String} arg.name - event name
241
+ * @param {Object} arg.payload - event payload
242
+ * @param {Object} arg.options - other options
243
+ * @returns {Promise} promise that resolves to options to be used with fetch
244
+ */
245
+ }, {
246
+ key: "buildClientEventFetchRequestOptions",
247
+ value: function () {
248
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref7) {
249
+ var name, payload, options;
250
+ return _regenerator.default.wrap(function _callee$(_context) {
251
+ while (1) switch (_context.prev = _context.next) {
252
+ case 0:
253
+ name = _ref7.name, payload = _ref7.payload, options = _ref7.options;
254
+ return _context.abrupt("return", this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({
255
+ name: name,
256
+ payload: payload,
257
+ options: options
258
+ }));
259
+ case 2:
260
+ case "end":
261
+ return _context.stop();
262
+ }
263
+ }, _callee, this);
264
+ }));
265
+ function buildClientEventFetchRequestOptions(_x) {
266
+ return _buildClientEventFetchRequestOptions.apply(this, arguments);
267
+ }
268
+ return buildClientEventFetchRequestOptions;
269
+ }()
270
+ /**
271
+ * Submits a metric from pre-built request options via the fetch API. Updates
272
+ * the "$timings" and "originTime" values to Date.now() since the existing times
273
+ * were set when the options were built (not submitted).
274
+ * @param {any} options - the pre-built request options for submitting a metric
275
+ * @returns {Promise} promise that resolves to the response object
276
+ */
277
+ }, {
278
+ key: "setMetricTimingsAndFetch",
279
+ value: function setMetricTimingsAndFetch(options) {
280
+ // @ts-ignore
281
+ return this.webex.setTimingsAndFetch((0, _callDiagnosticMetrics2.setMetricTimings)(options));
282
+ }
283
+
284
+ /**
285
+ * Returns true if the specified serviceErrorCode maps to an expected error.
286
+ * @param {number} serviceErrorCode the service error code
287
+ * @returns {boolean}
288
+ */
289
+ }, {
290
+ key: "isServiceErrorExpected",
291
+ value: function isServiceErrorExpected(serviceErrorCode) {
292
+ return this.callDiagnosticMetrics.isServiceErrorExpected(serviceErrorCode);
293
+ }
294
+ }]);
295
+ return Metrics;
296
+ }(_webexCore.WebexPlugin);
297
+ (0, _defineProperty2.default)(Metrics, "instance", void 0);
298
+ var _default = Metrics;
299
+ exports.default = _default;
300
+ //# sourceMappingURL=new-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Metrics","args","callDiagnosticLatencies","CallDiagnosticLatencies","parent","webex","onReady","once","callDiagnosticMetrics","CallDiagnosticMetrics","name","payload","options","clearTimestamps","saveTimestamp","key","Error","submitMQE","logger","log","resolve","meetingId","submitClientEvent","preLoginId","request","method","api","resource","headers","body","qs","alias","then","res","catch","err","error","generateCommonErrorMetadata","reject","buildClientEventFetchRequestOptions","setTimingsAndFetch","setMetricTimings","serviceErrorCode","isServiceErrorExpected","WebexPlugin"],"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;AAEA;AAWA;AACA;AACA;AAAoD;AAAA;AAEpD;AACA;AACA;AACA;AAHA,IAIMA,OAAO;EAAA;EAAA;EACX;;EAGA;;EAEA;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,mBAAqB;IAAA;IAAA;IAAA,kCAANC,IAAI;MAAJA,IAAI;IAAA;IACjB,gDAASA,IAAI;;IAEb;IAAA;IAAA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EAAC7B,OAAO,CAAC,CAAC;IACjE;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,OAKA,gCAA8B8B,gBAAwB,EAAW;MAC/D,OAAO,IAAI,CAAClC,qBAAqB,CAACmC,sBAAsB,CAACD,gBAAgB,CAAC;IAC5E;EAAC;EAAA;AAAA,EAxPmBE,sBAAW;AAAA,8BAA3B5C,OAAO;AAAA,eA2PEA,OAAO;AAAA"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
10
+ var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
11
+ var _batcher = _interopRequireDefault(require("./batcher"));
12
+ var _callDiagnosticMetrics = require("./call-diagnostic/call-diagnostic-metrics.util");
13
+ var _utils = require("./utils");
14
+ var PRE_LOGIN_METRICS_IDENTIFIER = 'Pre Login Metrics -->';
15
+ var PreLoginMetricsBatcher = _batcher.default.extend({
16
+ namespace: 'Metrics',
17
+ preLoginId: undefined,
18
+ /**
19
+ * Save the pre-login ID.
20
+ * @param {string} preLoginId The pre-login ID to be saved.
21
+ * @returns {void}
22
+ */
23
+ savePreLoginId: function savePreLoginId(preLoginId) {
24
+ this.preLoginId = preLoginId;
25
+ },
26
+ /**
27
+ * Prepare item
28
+ * @param {any} item
29
+ * @returns {Promise<any>}
30
+ */
31
+ prepareItem: function prepareItem(item) {
32
+ return _promise.default.resolve((0, _callDiagnosticMetrics.prepareDiagnosticMetricItem)(this.webex, item));
33
+ },
34
+ /**
35
+ * Prepare request, add time sensitive date etc.
36
+ * @param {any[]} queue
37
+ * @returns {Promise<any[]>}
38
+ */
39
+ prepareRequest: function prepareRequest(queue) {
40
+ // Add sent timestamp
41
+ queue.forEach(function (item) {
42
+ item.eventPayload.originTime = item.eventPayload.originTime || {};
43
+ item.eventPayload.originTime.sent = new Date().toISOString();
44
+ });
45
+ return _promise.default.resolve(queue);
46
+ },
47
+ /**
48
+ *
49
+ * @param {any} payload
50
+ * @returns {Promise<any>}
51
+ */
52
+ submitHttpRequest: function submitHttpRequest(payload) {
53
+ var _this = this;
54
+ var batchId = (0, _uniqueId2.default)('prelogin-ca-batch-');
55
+ if (this.preLoginId === undefined) {
56
+ this.webex.logger.error(PRE_LOGIN_METRICS_IDENTIFIER, "PreLoginMetricsBatcher: @submitHttpRequest#".concat(batchId, ". PreLoginId is not set."));
57
+ return _promise.default.reject(new Error('PreLoginId is not set.'));
58
+ }
59
+ return this.webex.request({
60
+ method: 'POST',
61
+ service: 'metrics',
62
+ resource: 'clientmetrics-prelogin',
63
+ headers: {
64
+ authorization: false,
65
+ 'x-prelogin-userid': this.preLoginId
66
+ },
67
+ body: {
68
+ metrics: payload
69
+ },
70
+ waitForServiceTimeout: this.webex.config.metrics.waitForServiceTimeout
71
+ }).then(function (res) {
72
+ _this.webex.logger.log(PRE_LOGIN_METRICS_IDENTIFIER, "PreLoginMetricsBatcher: @submitHttpRequest#".concat(batchId, ". Request successful."));
73
+ return res;
74
+ }).catch(function (err) {
75
+ _this.webex.logger.error(PRE_LOGIN_METRICS_IDENTIFIER, "PreLoginMetricsBatcher: @submitHttpRequest#".concat(batchId, ". Request failed:"), "error: ".concat((0, _utils.generateCommonErrorMetadata)(err)));
76
+ return _promise.default.reject(err);
77
+ });
78
+ }
79
+ });
80
+ var _default = PreLoginMetricsBatcher;
81
+ exports.default = _default;
82
+ //# sourceMappingURL=prelogin-metrics-batcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PRE_LOGIN_METRICS_IDENTIFIER","PreLoginMetricsBatcher","Batcher","extend","namespace","preLoginId","undefined","savePreLoginId","prepareItem","item","resolve","prepareDiagnosticMetricItem","webex","prepareRequest","queue","forEach","eventPayload","originTime","sent","Date","toISOString","submitHttpRequest","payload","batchId","logger","error","reject","Error","request","method","service","resource","headers","authorization","body","metrics","waitForServiceTimeout","config","then","res","log","catch","err","generateCommonErrorMetadata"],"sources":["prelogin-metrics-batcher.ts"],"sourcesContent":["import {uniqueId} from 'lodash';\nimport Batcher from './batcher';\nimport {prepareDiagnosticMetricItem} from './call-diagnostic/call-diagnostic-metrics.util';\nimport {generateCommonErrorMetadata} from './utils';\n\nconst PRE_LOGIN_METRICS_IDENTIFIER = 'Pre Login Metrics -->';\n\nconst PreLoginMetricsBatcher = Batcher.extend({\n namespace: 'Metrics',\n preLoginId: undefined,\n\n /**\n * Save the pre-login ID.\n * @param {string} preLoginId The pre-login ID to be saved.\n * @returns {void}\n */\n savePreLoginId(preLoginId) {\n this.preLoginId = preLoginId;\n },\n\n /**\n * Prepare item\n * @param {any} item\n * @returns {Promise<any>}\n */\n prepareItem(item) {\n return Promise.resolve(prepareDiagnosticMetricItem(this.webex, item));\n },\n\n /**\n * Prepare request, add time sensitive date etc.\n * @param {any[]} queue\n * @returns {Promise<any[]>}\n */\n prepareRequest(queue) {\n // Add sent timestamp\n queue.forEach((item) => {\n item.eventPayload.originTime = item.eventPayload.originTime || {};\n item.eventPayload.originTime.sent = new Date().toISOString();\n });\n\n return Promise.resolve(queue);\n },\n\n /**\n *\n * @param {any} payload\n * @returns {Promise<any>}\n */\n submitHttpRequest(payload: any) {\n const batchId = uniqueId('prelogin-ca-batch-');\n if (this.preLoginId === undefined) {\n this.webex.logger.error(\n PRE_LOGIN_METRICS_IDENTIFIER,\n `PreLoginMetricsBatcher: @submitHttpRequest#${batchId}. PreLoginId is not set.`\n );\n\n return Promise.reject(new Error('PreLoginId is not set.'));\n }\n\n return this.webex\n .request({\n method: 'POST',\n service: 'metrics',\n resource: 'clientmetrics-prelogin',\n headers: {\n authorization: false,\n 'x-prelogin-userid': this.preLoginId,\n },\n body: {\n metrics: payload,\n },\n waitForServiceTimeout: this.webex.config.metrics.waitForServiceTimeout,\n })\n .then((res) => {\n this.webex.logger.log(\n PRE_LOGIN_METRICS_IDENTIFIER,\n `PreLoginMetricsBatcher: @submitHttpRequest#${batchId}. Request successful.`\n );\n\n return res;\n })\n .catch((err) => {\n this.webex.logger.error(\n PRE_LOGIN_METRICS_IDENTIFIER,\n `PreLoginMetricsBatcher: @submitHttpRequest#${batchId}. Request failed:`,\n `error: ${generateCommonErrorMetadata(err)}`\n );\n\n return Promise.reject(err);\n });\n },\n});\n\nexport default PreLoginMetricsBatcher;\n"],"mappings":";;;;;;;;;;AACA;AACA;AACA;AAEA,IAAMA,4BAA4B,GAAG,uBAAuB;AAE5D,IAAMC,sBAAsB,GAAGC,gBAAO,CAACC,MAAM,CAAC;EAC5CC,SAAS,EAAE,SAAS;EACpBC,UAAU,EAAEC,SAAS;EAErB;AACF;AACA;AACA;AACA;EACEC,cAAc,0BAACF,UAAU,EAAE;IACzB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B,CAAC;EAED;AACF;AACA;AACA;AACA;EACEG,WAAW,uBAACC,IAAI,EAAE;IAChB,OAAO,iBAAQC,OAAO,CAAC,IAAAC,kDAA2B,EAAC,IAAI,CAACC,KAAK,EAAEH,IAAI,CAAC,CAAC;EACvE,CAAC;EAED;AACF;AACA;AACA;AACA;EACEI,cAAc,0BAACC,KAAK,EAAE;IACpB;IACAA,KAAK,CAACC,OAAO,CAAC,UAACN,IAAI,EAAK;MACtBA,IAAI,CAACO,YAAY,CAACC,UAAU,GAAGR,IAAI,CAACO,YAAY,CAACC,UAAU,IAAI,CAAC,CAAC;MACjER,IAAI,CAACO,YAAY,CAACC,UAAU,CAACC,IAAI,GAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;IAC9D,CAAC,CAAC;IAEF,OAAO,iBAAQV,OAAO,CAACI,KAAK,CAAC;EAC/B,CAAC;EAED;AACF;AACA;AACA;AACA;EACEO,iBAAiB,6BAACC,OAAY,EAAE;IAAA;IAC9B,IAAMC,OAAO,GAAG,wBAAS,oBAAoB,CAAC;IAC9C,IAAI,IAAI,CAAClB,UAAU,KAAKC,SAAS,EAAE;MACjC,IAAI,CAACM,KAAK,CAACY,MAAM,CAACC,KAAK,CACrBzB,4BAA4B,uDACkBuB,OAAO,8BACtD;MAED,OAAO,iBAAQG,MAAM,CAAC,IAAIC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5D;IAEA,OAAO,IAAI,CAACf,KAAK,CACdgB,OAAO,CAAC;MACPC,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE,SAAS;MAClBC,QAAQ,EAAE,wBAAwB;MAClCC,OAAO,EAAE;QACPC,aAAa,EAAE,KAAK;QACpB,mBAAmB,EAAE,IAAI,CAAC5B;MAC5B,CAAC;MACD6B,IAAI,EAAE;QACJC,OAAO,EAAEb;MACX,CAAC;MACDc,qBAAqB,EAAE,IAAI,CAACxB,KAAK,CAACyB,MAAM,CAACF,OAAO,CAACC;IACnD,CAAC,CAAC,CACDE,IAAI,CAAC,UAACC,GAAG,EAAK;MACb,KAAI,CAAC3B,KAAK,CAACY,MAAM,CAACgB,GAAG,CACnBxC,4BAA4B,uDACkBuB,OAAO,2BACtD;MAED,OAAOgB,GAAG;IACZ,CAAC,CAAC,CACDE,KAAK,CAAC,UAACC,GAAG,EAAK;MACd,KAAI,CAAC9B,KAAK,CAACY,MAAM,CAACC,KAAK,CACrBzB,4BAA4B,uDACkBuB,OAAO,yCAC3C,IAAAoB,kCAA2B,EAACD,GAAG,CAAC,EAC3C;MAED,OAAO,iBAAQhB,MAAM,CAACgB,GAAG,CAAC;IAC5B,CAAC,CAAC;EACN;AACF,CAAC,CAAC;AAAC,eAEYzC,sBAAsB;AAAA"}
@@ -0,0 +1,7 @@
1
+ export default MetricsBatcher;
2
+ /**
3
+ * @class
4
+ * @extends Batcher
5
+ * @memberof Metrics
6
+ */
7
+ declare const MetricsBatcher: any;
@@ -0,0 +1,2 @@
1
+ declare const CallDiagnosticEventsBatcher: any;
2
+ export default CallDiagnosticEventsBatcher;
@@ -0,0 +1,218 @@
1
+ import { WebexPlugin } from '@webex/webex-core';
2
+ import { MetricEventNames, PreComputedLatencies } from '../metrics.types';
3
+ /**
4
+ * @description Helper class to store latencies timestamp and to calculate various latencies for CA.
5
+ * @exports
6
+ * @class CallDiagnosticLatencies
7
+ */
8
+ export default class CallDiagnosticLatencies extends WebexPlugin {
9
+ latencyTimestamps: Map<MetricEventNames, number>;
10
+ precomputedLatencies: Map<PreComputedLatencies, number>;
11
+ private meetingId?;
12
+ /**
13
+ * @constructor
14
+ */
15
+ constructor(...args: any[]);
16
+ /**
17
+ * Clear timestamps
18
+ */
19
+ clearTimestamps(): void;
20
+ /**
21
+ * Associate current latencies with a meeting id
22
+ * @param meetingId
23
+ */
24
+ private setMeetingId;
25
+ /**
26
+ * Returns the meeting object associated with current latencies
27
+ * @returns meeting object
28
+ */
29
+ private getMeeting;
30
+ /**
31
+ * Store timestamp value
32
+ * @param key - key
33
+ * @param value -value
34
+ * @throws
35
+ * @returns
36
+ */
37
+ saveTimestamp({ key, value, options, }: {
38
+ key: MetricEventNames;
39
+ value?: number;
40
+ options?: {
41
+ meetingId?: string;
42
+ };
43
+ }): void;
44
+ /**
45
+ * Store precomputed latency value
46
+ * @param key - key
47
+ * @param value - value
48
+ * @param overwrite - overwrite existing value or add it
49
+ * @throws
50
+ * @returns
51
+ */
52
+ saveLatency(key: PreComputedLatencies, value: number, overwrite?: boolean): void;
53
+ /**
54
+ * Measure latency for a request
55
+ * @param key - key
56
+ * @param callback - callback for which you would like to measure latency
57
+ * @param overwrite - overwite existing value or add to it
58
+ * @returns
59
+ */
60
+ measureLatency(callback: () => Promise<any>, key: PreComputedLatencies, overwrite?: boolean): Promise<any>;
61
+ /**
62
+ * Store only the first timestamp value for the given key
63
+ * @param key - key
64
+ * @param value -value
65
+ * @throws
66
+ * @returns
67
+ */
68
+ saveFirstTimestampOnly(key: MetricEventNames, value?: number): void;
69
+ /**
70
+ * Helper to calculate end - start
71
+ * @param a start
72
+ * @param b end
73
+ * @returns latency
74
+ */
75
+ getDiffBetweenTimestamps(a: MetricEventNames, b: MetricEventNames): number;
76
+ /**
77
+ * Meeting Info Request
78
+ * @note Meeting Info request happen not just in the join phase. CA requires
79
+ * metrics around meeting info request that are only part of join phase.
80
+ * This internal.* event is used to track the real timestamps
81
+ * (when the actual request/response happen). This is because the actual CA event is
82
+ * sent inside the join method on the meeting object based on some logic, but that's not exactly when
83
+ * those events are actually fired. The logic only confirms that they have happened, and we send them over.
84
+ * @returns - latency
85
+ */
86
+ getMeetingInfoReqResp(): number;
87
+ /**
88
+ * Interstitial Time
89
+ * @returns - latency
90
+ */
91
+ getShowInterstitialTime(): number;
92
+ /**
93
+ * getU2CTime
94
+ * @returns - latency
95
+ */
96
+ getU2CTime(): number;
97
+ /**
98
+ * Device Register Time
99
+ * @returns - latency
100
+ */
101
+ getRegisterWDMDeviceJMT(): number;
102
+ /**
103
+ * Call Init Join Request
104
+ * @returns - latency
105
+ */
106
+ getCallInitJoinReq(): number;
107
+ /**
108
+ * Locus Join Request
109
+ * @returns - latency
110
+ */
111
+ getJoinReqResp(): number;
112
+ /**
113
+ * Time taken to do turn discovery
114
+ * @returns - latency
115
+ */
116
+ getTurnDiscoveryTime(): number;
117
+ /**
118
+ * Local SDP Generated Remote SDP REceived
119
+ * @returns - latency
120
+ */
121
+ getLocalSDPGenRemoteSDPRecv(): number;
122
+ /**
123
+ * ICE Setup Time
124
+ * @returns - latency
125
+ */
126
+ getICESetupTime(): number;
127
+ /**
128
+ * Audio ICE time
129
+ * @returns - latency
130
+ */
131
+ getAudioICESetupTime(): number;
132
+ /**
133
+ * Video ICE Time
134
+ * @returns - latency
135
+ */
136
+ getVideoICESetupTime(): number;
137
+ /**
138
+ * Share ICE Time
139
+ * @returns - latency
140
+ */
141
+ getShareICESetupTime(): number;
142
+ /**
143
+ * Stay Lobby Time
144
+ * @returns - latency
145
+ */
146
+ getStayLobbyTime(): number;
147
+ /**
148
+ * Page JMT
149
+ * @returns - latency
150
+ */
151
+ getPageJMT(): number;
152
+ /**
153
+ * Download Time JMT
154
+ * @returns - latency
155
+ */
156
+ getDownloadTimeJMT(): number;
157
+ /**
158
+ * Click To Interstitial
159
+ * @returns - latency
160
+ */
161
+ getClickToInterstitial(): number;
162
+ /**
163
+ * Interstitial To Join Ok
164
+ * @returns - latency
165
+ */
166
+ getInterstitialToJoinOK(): number;
167
+ /**
168
+ * Call Init To MediaEngineReady
169
+ * @returns - latency
170
+ */
171
+ getCallInitMediaEngineReady(): number;
172
+ /**
173
+ * Interstitial To Media Ok
174
+ * @returns - latency
175
+ */
176
+ getInterstitialToMediaOKJMT(): number;
177
+ /**
178
+ * Total JMT
179
+ * @returns - latency
180
+ */
181
+ getTotalJMT(): number;
182
+ /**
183
+ * Join Conf JMT
184
+ * @returns - latency
185
+ */
186
+ getJoinConfJMT(): number;
187
+ /**
188
+ * Total Media JMT
189
+ * @returns - latency
190
+ */
191
+ getTotalMediaJMT(): number;
192
+ /**
193
+ * Client JMT
194
+ * @returns - latency
195
+ */
196
+ getClientJMT(): number;
197
+ /**
198
+ * Audio setup delay receive
199
+ */
200
+ getAudioJoinRespRxStart(): number;
201
+ /**
202
+ * Video setup delay receive
203
+ */
204
+ getVideoJoinRespRxStart(): number;
205
+ /**
206
+ * Audio setup delay transmit
207
+ */
208
+ getAudioJoinRespTxStart(): number;
209
+ /**
210
+ * Video setup delay transmit
211
+ */
212
+ getVideoJoinRespTxStart(): number;
213
+ /**
214
+ * Total latency for all other app api requests.
215
+ * Excludes meeting info, because it's measured separately.
216
+ */
217
+ getOtherAppApiReqResp(): number;
218
+ }