@webex/internal-plugin-metrics 3.12.0-auth-prejoin-fetch.1 → 3.12.0-llmrefactor.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.
- package/README.md +239 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +52 -18
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/config.js +3 -1
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +118 -5
- package/dist/metrics.js.map +1 -1
- package/dist/network-telemetry.js +610 -0
- package/dist/network-telemetry.js.map +1 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +9 -3
- package/dist/types/call-diagnostic/config.d.ts +2 -0
- package/dist/types/config.d.ts +5 -0
- package/dist/types/network-telemetry.d.ts +108 -0
- package/package.json +10 -10
- package/src/call-diagnostic/call-diagnostic-metrics.ts +56 -20
- package/src/call-diagnostic/config.ts +2 -0
- package/src/config.js +4 -0
- package/src/index.ts +9 -0
- package/src/metrics.js +123 -5
- package/src/network-telemetry.ts +757 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +211 -21
- package/test/unit/spec/metrics.js +14 -5
- package/test/unit/spec/network-telemetry.ts +610 -0
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ This is an internal Cisco Webex plugin. As such, it does not strictly adhere to
|
|
|
9
9
|
- [Install](#install)
|
|
10
10
|
- [Usage](#usage)
|
|
11
11
|
- [Unhandled exception telemetry](#unhandled-exception-telemetry)
|
|
12
|
+
- [Network request telemetry](#network-request-telemetry)
|
|
12
13
|
- [Contribute](#contribute)
|
|
13
14
|
- [Maintainers](#maintainers)
|
|
14
15
|
- [License](#license)
|
|
@@ -47,7 +48,7 @@ Telemetry is disabled by default. Enable it with
|
|
|
47
48
|
include application context such as `orgId` and `dataCenter`. Metadata must not contain personally
|
|
48
49
|
identifiable information or credentials.
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
````js
|
|
51
52
|
import Webex from 'webex';
|
|
52
53
|
|
|
53
54
|
const webex = Webex.init({
|
|
@@ -63,6 +64,243 @@ const webex = Webex.init({
|
|
|
63
64
|
},
|
|
64
65
|
},
|
|
65
66
|
});
|
|
67
|
+
## Network request telemetry
|
|
68
|
+
|
|
69
|
+
Network request telemetry is disabled by default. Enable it with
|
|
70
|
+
`metrics.networkTelemetry.enabled: true`. When enabled, the metrics plugin summarizes requests
|
|
71
|
+
made through the Webex SDK request pipeline. The reporting interval is configurable with
|
|
72
|
+
`metrics.networkTelemetry.intervalMs` and defaults to ten minutes. It listens to the SDK-wide `request:start`,
|
|
73
|
+
`request:success`, and `request:failure` events, so individual plugins do not need to wrap or
|
|
74
|
+
replace `webex.request()`.
|
|
75
|
+
|
|
76
|
+
For example, to collect one-minute windows:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
const webex = Webex.init({
|
|
80
|
+
config: {
|
|
81
|
+
metrics: {
|
|
82
|
+
networkTelemetry: {
|
|
83
|
+
enabled: true,
|
|
84
|
+
intervalMs: 60 * 1_000,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The listeners are installed once for each Webex instance when `webex.internal.metrics` is
|
|
92
|
+
constructed and the feature is enabled. The metrics package must be imported before constructing
|
|
93
|
+
the Webex instance. Standard Webex SDK bundles already import and register the metrics plugin.
|
|
94
|
+
|
|
95
|
+
### Scope
|
|
96
|
+
|
|
97
|
+
The collector counts request and response outcomes that pass through `webex.request()` and its interceptors. For failures, it also records aggregated error details covering:
|
|
98
|
+
|
|
99
|
+
- HTTP responses rejected by the SDK, such as `4xx` and `5xx` responses.
|
|
100
|
+
- Network or CORS failures where no HTTP response is available.
|
|
101
|
+
- Aborted and timed-out SDK requests when the error exposes that information.
|
|
102
|
+
- Request preparation failures that emit `request:failure`.
|
|
103
|
+
|
|
104
|
+
It does not monitor arbitrary application `fetch()`, `XMLHttpRequest`, WebSocket, or other traffic outside the SDK request pipeline. It also does not use `PerformanceObserver` or browser-wide request interception.
|
|
105
|
+
|
|
106
|
+
### Event flow
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
webex.request()
|
|
110
|
+
-> SDK request interceptors
|
|
111
|
+
-> request:start(options)
|
|
112
|
+
-> request:success(options, response) or request:failure(options, reason)
|
|
113
|
+
-> metrics request outcome listeners
|
|
114
|
+
-> aggregate host, endpoint, response, and error counts
|
|
115
|
+
-> every configured interval, submit JS_SDK_NETWORK_REQUEST_SUMMARY
|
|
116
|
+
````
|
|
117
|
+
|
|
118
|
+
The listeners and ten-minute accumulator are registered during metrics plugin initialization:
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
initialize(...args) {
|
|
122
|
+
WebexPlugin.prototype.initialize.call(this, ...args);
|
|
123
|
+
if (this.webex.config.metrics.networkTelemetry.enabled !== true) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.networkTelemetry = createNetworkTelemetryCollector(/* submission callbacks */);
|
|
127
|
+
this.listenTo(this.webex, 'request:start', this.recordNetworkRequestStart);
|
|
128
|
+
this.listenTo(this.webex, 'request:success', this.recordNetworkRequestSuccess);
|
|
129
|
+
this.listenTo(this.webex, 'request:failure', this.recordNetworkRequestFailure);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The metrics plugin exposes `flushNetworkTelemetry()` for callers that need to submit the current
|
|
134
|
+
non-empty window immediately, such as after an early call failure. When the metrics plugin is
|
|
135
|
+
stopped, any non-empty partial window is submitted once before the collector is disposed. Empty
|
|
136
|
+
windows are not submitted during shutdown, and the shutdown hook waits for the submission attempt
|
|
137
|
+
to settle.
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
await webex.internal.metrics.flushNetworkTelemetry();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Metric schema
|
|
144
|
+
|
|
145
|
+
One operational client metric named `JS_SDK_NETWORK_REQUEST_SUMMARY` is submitted at the configured
|
|
146
|
+
interval. Its `eventPayload` has this shape:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
type NetworkTelemetry = {
|
|
150
|
+
metricsSummary: {
|
|
151
|
+
totalSendRequest: number;
|
|
152
|
+
totalFailedRequest: number;
|
|
153
|
+
totalRecvdResponse: number;
|
|
154
|
+
totalFailedResponse: number;
|
|
155
|
+
};
|
|
156
|
+
metrics: Array<{
|
|
157
|
+
host: string;
|
|
158
|
+
endPoint: string;
|
|
159
|
+
countSendRequest: number;
|
|
160
|
+
countFailedRequest: number;
|
|
161
|
+
countRecvdResponse: number;
|
|
162
|
+
countFailedResponse: number;
|
|
163
|
+
averageNetworkDurationMs: number;
|
|
164
|
+
maxNetworkDurationP90Ms: number;
|
|
165
|
+
maxNetworkDurationP99Ms: number;
|
|
166
|
+
}>;
|
|
167
|
+
errorMetrics: Array<{
|
|
168
|
+
host: string;
|
|
169
|
+
endPoint: string;
|
|
170
|
+
statusCode: number;
|
|
171
|
+
errorCode: string;
|
|
172
|
+
method: string;
|
|
173
|
+
errorType: string;
|
|
174
|
+
errorMessage: string;
|
|
175
|
+
trackingIds: string[];
|
|
176
|
+
countError: number;
|
|
177
|
+
}>;
|
|
178
|
+
errorMetricsSummary: Record<string, {count: number}>;
|
|
179
|
+
};
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The SDK adds application metadata to the outer client metric when it wraps this `eventPayload`:
|
|
183
|
+
|
|
184
|
+
| Property | Source |
|
|
185
|
+
| -------------------- | --------------------------------------------------------------------------- |
|
|
186
|
+
| `tags.app_name` | `webex.config.appName`, or `unknown` |
|
|
187
|
+
| `tags.app_version` | `webex.config.appVersion`, or `unknown` |
|
|
188
|
+
| `tags.app_url` | Browser origin without path/query data, hostname fallback, or `non-browser` |
|
|
189
|
+
| `fields.sdk_version` | `webex.version` |
|
|
190
|
+
|
|
191
|
+
Counter mapping:
|
|
192
|
+
|
|
193
|
+
| Event or outcome | Summary and endpoint counters |
|
|
194
|
+
| --------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
195
|
+
| `request:start` | `totalSendRequest`, `countSendRequest` |
|
|
196
|
+
| `request:success` | `totalRecvdResponse`, `countRecvdResponse` |
|
|
197
|
+
| `request:failure` without an HTTP response | `totalFailedRequest`, `countFailedRequest` |
|
|
198
|
+
| `request:failure` with an HTTP status (`4xx`/`5xx`) | Received-response counters plus `totalFailedResponse`/`countFailedResponse` |
|
|
199
|
+
|
|
200
|
+
The `metrics` array is grouped by `host` and `endPoint`. For service-based SDK requests, `host` is the normalized logical service name. Direct-URI requests use the URI host. `endPoint` is a sanitized resource or URI path. `averageNetworkDurationMs` is the average measured network duration for completed requests in the group, while `maxNetworkDurationP90Ms` and `maxNetworkDurationP99Ms` are the maximum durations at the nearest-rank 90th and 99th percentiles. All values are in milliseconds.
|
|
201
|
+
|
|
202
|
+
The `errorMetrics` array groups identical failures by host, endpoint, status code, error code, method, error type, and error message. `countError` records the number of occurrences, while `trackingIds` retains at most ten unique identifiers. `errorMetricsSummary` counts errors by status code; status `0` means no HTTP response was available.
|
|
203
|
+
|
|
204
|
+
Example:
|
|
205
|
+
|
|
206
|
+
```js
|
|
207
|
+
{
|
|
208
|
+
metricName: 'JS_SDK_NETWORK_REQUEST_SUMMARY',
|
|
209
|
+
type: 'operational',
|
|
210
|
+
fields: {
|
|
211
|
+
totalSendRequest: 14,
|
|
212
|
+
totalFailedRequest: 1,
|
|
213
|
+
totalRecvdResponse: 13,
|
|
214
|
+
totalFailedResponse: 1
|
|
215
|
+
},
|
|
216
|
+
eventPayload: {
|
|
217
|
+
metricsSummary: {
|
|
218
|
+
totalSendRequest: 14,
|
|
219
|
+
totalFailedRequest: 1,
|
|
220
|
+
totalRecvdResponse: 13,
|
|
221
|
+
totalFailedResponse: 1
|
|
222
|
+
},
|
|
223
|
+
metrics: [{
|
|
224
|
+
host: 'hydra',
|
|
225
|
+
endPoint: 'rooms/:id/messages',
|
|
226
|
+
countSendRequest: 2,
|
|
227
|
+
countFailedRequest: 0,
|
|
228
|
+
countRecvdResponse: 2,
|
|
229
|
+
countFailedResponse: 1,
|
|
230
|
+
averageNetworkDurationMs: 410,
|
|
231
|
+
maxNetworkDurationP90Ms: 510,
|
|
232
|
+
maxNetworkDurationP99Ms: 640
|
|
233
|
+
}],
|
|
234
|
+
errorMetrics: [{
|
|
235
|
+
host: 'hydra',
|
|
236
|
+
endPoint: 'rooms/:id/messages',
|
|
237
|
+
statusCode: 503,
|
|
238
|
+
errorCode: 'SERVICE_UNAVAILABLE',
|
|
239
|
+
method: 'POST',
|
|
240
|
+
errorType: 'server_error',
|
|
241
|
+
errorMessage: 'Service unavailable',
|
|
242
|
+
trackingIds: ['example-tracking-id'],
|
|
243
|
+
countError: 1
|
|
244
|
+
}],
|
|
245
|
+
errorMetricsSummary: {
|
|
246
|
+
503: {count: 1}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Failure classification
|
|
253
|
+
|
|
254
|
+
Classification is evaluated in the following order:
|
|
255
|
+
|
|
256
|
+
| Condition | `errorType` |
|
|
257
|
+
| --------------------------------------------------------------------------------------------------------- | --------------- |
|
|
258
|
+
| Error name is `AbortError` | `aborted` |
|
|
259
|
+
| Status is `408` or `504`, timeout appears in the error details, or the configured request timeout elapsed | `timeout` |
|
|
260
|
+
| Status is `429` | `rate_limited` |
|
|
261
|
+
| Status is `5xx` | `server_error` |
|
|
262
|
+
| Status is `4xx` | `client_error` |
|
|
263
|
+
| No response status is available, or the error name contains `network` | `network_error` |
|
|
264
|
+
| Any other SDK request failure | `request_error` |
|
|
265
|
+
|
|
266
|
+
### Telemetry request exclusion
|
|
267
|
+
|
|
268
|
+
Requests to the `metrics` and `unifiedTelemetry` services are excluded from both success and failure collection. The exclusion also covers the legacy `api: 'metrics'` request option. This prevents a telemetry upload from affecting its own summary.
|
|
269
|
+
|
|
270
|
+
The exclusion is centralized in the collector; telemetry request call sites do not require special flags.
|
|
271
|
+
|
|
272
|
+
### Endpoint normalization and cardinality
|
|
273
|
+
|
|
274
|
+
The `endPoint` value is derived from `options.resource`, or from the URI path for a direct-URI request:
|
|
275
|
+
|
|
276
|
+
- Query parameters and fragments are removed.
|
|
277
|
+
- Numeric, percent-encoded, uppercase, and otherwise non-route-looking segments are replaced with `:id`.
|
|
278
|
+
|
|
279
|
+
For example:
|
|
280
|
+
|
|
281
|
+
```text
|
|
282
|
+
rooms/Y2lzY29zcGFyazovL3VzL1JPT00/messages?personId=secret
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
becomes:
|
|
286
|
+
|
|
287
|
+
```text
|
|
288
|
+
rooms/:id/messages
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Endpoint normalization is heuristic. A short lowercase alphabetic identifier can resemble a static route segment. Do not place sensitive values directly in a resource path; use normal SDK resource identifiers and avoid embedding credentials or personal data in route names. Error messages are included because they are part of the requested error aggregate schema; callers should not put credentials or personal data in thrown error messages.
|
|
292
|
+
|
|
293
|
+
### Submission behavior
|
|
294
|
+
|
|
295
|
+
Each ten-minute summary uses the existing `submitClientMetrics()` batching and transport path. The accumulator resets at the reporting boundary before asynchronous submission, so requests received while a summary is being sent belong to the next window. A telemetry submission failure is caught and logged.
|
|
296
|
+
|
|
297
|
+
### Tests
|
|
298
|
+
|
|
299
|
+
Run the focused unit tests with Node.js 22.14:
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
nvm use 22.14
|
|
303
|
+
yarn workspace @webex/internal-plugin-metrics test:unit --targets network-telemetry.ts
|
|
66
304
|
```
|
|
67
305
|
|
|
68
306
|
## Maintainers
|
|
@@ -49,6 +49,10 @@ var _BrowserDetection = (0, _common.BrowserDetection)(),
|
|
|
49
49
|
getOSVersion = _BrowserDetection.getOSVersion,
|
|
50
50
|
getBrowserName = _BrowserDetection.getBrowserName,
|
|
51
51
|
getBrowserVersion = _BrowserDetection.getBrowserVersion;
|
|
52
|
+
var LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE = {
|
|
53
|
+
429: _config2.LOCUS_RATE_LIMITED_OUTGOING_CLIENT_CODE,
|
|
54
|
+
503: _config2.LOCUS_UNAVAILABLE_CLIENT_CODE
|
|
55
|
+
};
|
|
52
56
|
/**
|
|
53
57
|
* @description Util class to handle Call Analyzer Metrics
|
|
54
58
|
* @export
|
|
@@ -354,6 +358,22 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
354
358
|
throw new Error("ClientType and SubClientType can't be undefined");
|
|
355
359
|
}
|
|
356
360
|
|
|
361
|
+
/**
|
|
362
|
+
* Returns the signed-in user's CI ID derived from credentials tokens.
|
|
363
|
+
* Used as a fallback when no device is registered.
|
|
364
|
+
* @returns the userId, or undefined if it can't be determined
|
|
365
|
+
*/
|
|
366
|
+
}, {
|
|
367
|
+
key: "getUserIdFromCredentials",
|
|
368
|
+
value: function getUserIdFromCredentials() {
|
|
369
|
+
try {
|
|
370
|
+
// @ts-ignore
|
|
371
|
+
return this.webex.credentials.getUserId();
|
|
372
|
+
} catch (_unused) {
|
|
373
|
+
return undefined;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
357
377
|
/**
|
|
358
378
|
* Gather identifier details for call diagnostic payload.
|
|
359
379
|
* @throws Error if initialization fails.
|
|
@@ -362,7 +382,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
362
382
|
}, {
|
|
363
383
|
key: "getIdentifiers",
|
|
364
384
|
value: function getIdentifiers(options) {
|
|
365
|
-
var _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
|
|
385
|
+
var _this$device, _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
|
|
366
386
|
var meeting = options.meeting,
|
|
367
387
|
mediaConnections = options.mediaConnections,
|
|
368
388
|
correlationId = options.correlationId,
|
|
@@ -395,7 +415,6 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
395
415
|
var device = this.device;
|
|
396
416
|
var _ref3 = (device === null || device === void 0 ? void 0 : device.config) || {},
|
|
397
417
|
installationId = _ref3.installationId;
|
|
398
|
-
identifiers.userId = (device === null || device === void 0 ? void 0 : device.userId) || preLoginId;
|
|
399
418
|
identifiers.deviceId = device === null || device === void 0 ? void 0 : device.url;
|
|
400
419
|
identifiers.orgId = device === null || device === void 0 ? void 0 : device.orgId;
|
|
401
420
|
// @ts-ignore
|
|
@@ -404,6 +423,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
404
423
|
identifiers.machineId = installationId;
|
|
405
424
|
}
|
|
406
425
|
}
|
|
426
|
+
|
|
427
|
+
// Prefer the device's userId, but fall back to the signed-in user's ID from
|
|
428
|
+
// credentials when no device is registered, then to the pre-login ID.
|
|
429
|
+
identifiers.userId = ((_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.userId) || this.getUserIdFromCredentials() || preLoginId;
|
|
407
430
|
if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
|
|
408
431
|
identifiers.locusUrl = meeting.locusUrl;
|
|
409
432
|
identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
|
|
@@ -651,7 +674,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
651
674
|
* @param arg.clientErrorCode
|
|
652
675
|
* @param arg.serviceErrorCode
|
|
653
676
|
* @param arg.payloadOverrides
|
|
654
|
-
* @param arg.
|
|
677
|
+
* @param arg.httpCode
|
|
655
678
|
* @returns
|
|
656
679
|
*/
|
|
657
680
|
}, {
|
|
@@ -662,7 +685,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
662
685
|
serviceErrorName = _ref7.serviceErrorName,
|
|
663
686
|
rawErrorMessage = _ref7.rawErrorMessage,
|
|
664
687
|
payloadOverrides = _ref7.payloadOverrides,
|
|
665
|
-
|
|
688
|
+
httpCode = _ref7.httpCode;
|
|
666
689
|
var error;
|
|
667
690
|
if (clientErrorCode) {
|
|
668
691
|
var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
|
|
@@ -684,8 +707,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
684
707
|
serviceErrorCode: serviceErrorCode
|
|
685
708
|
}, {
|
|
686
709
|
rawErrorMessage: rawErrorMessage
|
|
687
|
-
},
|
|
688
|
-
|
|
710
|
+
}, httpCode === undefined ? {} : {
|
|
711
|
+
httpCode: httpCode
|
|
689
712
|
}, partialParsedError, payloadOverrides || {});
|
|
690
713
|
return error;
|
|
691
714
|
}
|
|
@@ -831,13 +854,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
831
854
|
}, {
|
|
832
855
|
key: "generateClientEventErrorPayload",
|
|
833
856
|
value: function generateClientEventErrorPayload(rawError) {
|
|
834
|
-
var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso;
|
|
857
|
+
var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso, _rawError$options, _rawError$options2;
|
|
835
858
|
var cachedError = this.eventErrorCache.get(rawError);
|
|
836
859
|
if (cachedError) {
|
|
837
860
|
return [cachedError, true];
|
|
838
861
|
}
|
|
839
862
|
var rawErrorMessage = rawError.message;
|
|
840
|
-
var
|
|
863
|
+
var httpCode = rawError.statusCode;
|
|
864
|
+
var serviceErrorCode = (rawError === null || rawError === void 0 ? void 0 : (_rawError$error = rawError.error) === null || _rawError$error === void 0 ? void 0 : (_rawError$error$body = _rawError$error.body) === null || _rawError$error$body === void 0 ? void 0 : _rawError$error$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body = rawError.body) === null || _rawError$body === void 0 ? void 0 : _rawError$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body2 = rawError.body) === null || _rawError$body2 === void 0 ? void 0 : _rawError$body2.code) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body3 = rawError.body) === null || _rawError$body3 === void 0 ? void 0 : (_rawError$body3$reaso = _rawError$body3.reason) === null || _rawError$body3$reaso === void 0 ? void 0 : _rawError$body3$reaso.reasonCode);
|
|
841
865
|
var payload;
|
|
842
866
|
if (rawError.name) {
|
|
843
867
|
if ((0, _callDiagnosticMetrics.isBrowserMediaErrorName)(rawError.name)) {
|
|
@@ -846,7 +870,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
846
870
|
clientErrorCode: _config2.BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[rawError.name],
|
|
847
871
|
serviceErrorName: rawError.name,
|
|
848
872
|
rawErrorMessage: rawErrorMessage,
|
|
849
|
-
|
|
873
|
+
httpCode: httpCode
|
|
850
874
|
});
|
|
851
875
|
}
|
|
852
876
|
}
|
|
@@ -859,10 +883,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
859
883
|
clientErrorCode: _config2.SDP_OFFER_CREATION_ERROR_MAP[causeType] || _config2.SDP_OFFER_CREATION_ERROR_MAP.GENERAL,
|
|
860
884
|
serviceErrorName: rawError.name,
|
|
861
885
|
rawErrorMessage: rawErrorMessage,
|
|
862
|
-
|
|
886
|
+
httpCode: httpCode
|
|
863
887
|
});
|
|
864
888
|
}
|
|
865
|
-
var serviceErrorCode = (rawError === null || rawError === void 0 ? void 0 : (_rawError$error = rawError.error) === null || _rawError$error === void 0 ? void 0 : (_rawError$error$body = _rawError$error.body) === null || _rawError$error$body === void 0 ? void 0 : _rawError$error$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body = rawError.body) === null || _rawError$body === void 0 ? void 0 : _rawError$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body2 = rawError.body) === null || _rawError$body2 === void 0 ? void 0 : _rawError$body2.code) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body3 = rawError.body) === null || _rawError$body3 === void 0 ? void 0 : (_rawError$body3$reaso = _rawError$body3.reason) === null || _rawError$body3$reaso === void 0 ? void 0 : _rawError$body3$reaso.reasonCode);
|
|
866
889
|
if (serviceErrorCode) {
|
|
867
890
|
var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
|
|
868
891
|
if (clientErrorCode && !payload) {
|
|
@@ -870,17 +893,28 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
870
893
|
clientErrorCode: clientErrorCode,
|
|
871
894
|
serviceErrorCode: serviceErrorCode,
|
|
872
895
|
rawErrorMessage: rawErrorMessage,
|
|
873
|
-
|
|
896
|
+
httpCode: httpCode
|
|
874
897
|
});
|
|
875
898
|
}
|
|
876
|
-
|
|
899
|
+
}
|
|
900
|
+
var locusHttpClientErrorCode = LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE[httpCode];
|
|
901
|
+
var requestUrl = ((_rawError$options = rawError.options) === null || _rawError$options === void 0 ? void 0 : _rawError$options.uri) || ((_rawError$options2 = rawError.options) === null || _rawError$options2 === void 0 ? void 0 : _rawError$options2.url);
|
|
902
|
+
if (locusHttpClientErrorCode && !payload && requestUrl !== null && requestUrl !== void 0 && requestUrl.includes('locus')) {
|
|
903
|
+
payload = this.getErrorPayloadForClientErrorCode({
|
|
904
|
+
clientErrorCode: locusHttpClientErrorCode,
|
|
905
|
+
serviceErrorCode: serviceErrorCode,
|
|
906
|
+
rawErrorMessage: rawErrorMessage,
|
|
907
|
+
httpCode: httpCode
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
if (serviceErrorCode) {
|
|
877
911
|
// by default, if it is locus error, return new locus err
|
|
878
912
|
if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode) && !payload) {
|
|
879
913
|
payload = this.getErrorPayloadForClientErrorCode({
|
|
880
914
|
clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
|
|
881
915
|
serviceErrorCode: serviceErrorCode,
|
|
882
916
|
rawErrorMessage: rawErrorMessage,
|
|
883
|
-
|
|
917
|
+
httpCode: httpCode
|
|
884
918
|
});
|
|
885
919
|
}
|
|
886
920
|
}
|
|
@@ -889,7 +923,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
889
923
|
clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
|
|
890
924
|
serviceErrorCode: serviceErrorCode,
|
|
891
925
|
rawErrorMessage: rawErrorMessage,
|
|
892
|
-
|
|
926
|
+
httpCode: httpCode
|
|
893
927
|
});
|
|
894
928
|
}
|
|
895
929
|
if ((0, _callDiagnosticMetrics.isNetworkError)(rawError) && !payload) {
|
|
@@ -898,7 +932,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
898
932
|
serviceErrorCode: serviceErrorCode,
|
|
899
933
|
payloadOverrides: rawError.payloadOverrides,
|
|
900
934
|
rawErrorMessage: rawErrorMessage,
|
|
901
|
-
|
|
935
|
+
httpCode: httpCode
|
|
902
936
|
});
|
|
903
937
|
}
|
|
904
938
|
if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError) && !payload) {
|
|
@@ -907,7 +941,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
907
941
|
serviceErrorCode: serviceErrorCode,
|
|
908
942
|
payloadOverrides: rawError.payloadOverrides,
|
|
909
943
|
rawErrorMessage: rawErrorMessage,
|
|
910
|
-
|
|
944
|
+
httpCode: httpCode
|
|
911
945
|
});
|
|
912
946
|
}
|
|
913
947
|
if (!payload) {
|
|
@@ -918,7 +952,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
|
|
|
918
952
|
serviceErrorName: rawError === null || rawError === void 0 ? void 0 : rawError.name,
|
|
919
953
|
payloadOverrides: rawError.payloadOverrides,
|
|
920
954
|
rawErrorMessage: rawErrorMessage,
|
|
921
|
-
|
|
955
|
+
httpCode: httpCode
|
|
922
956
|
});
|
|
923
957
|
}
|
|
924
958
|
|