@webex/internal-plugin-metrics 3.0.0-beta.17 → 3.0.0-beta.171

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 +132 -0
  2. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
  3. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +339 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +511 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
  7. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +106 -0
  8. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
  9. package/dist/call-diagnostic/config.js +461 -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 +171 -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 +154 -0
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +324 -0
  31. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +31 -0
  32. package/dist/types/call-diagnostic/config.d.ts +57 -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 +87 -0
  41. package/dist/types/new-metrics.d.ts +83 -0
  42. package/package.json +12 -8
  43. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +146 -0
  44. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +308 -0
  45. package/src/call-diagnostic/call-diagnostic-metrics.ts +528 -0
  46. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +102 -0
  47. package/src/call-diagnostic/config.ts +455 -0
  48. package/src/call-diagnostic/generated-types-temp/ClientEvent.ts +2357 -0
  49. package/src/call-diagnostic/generated-types-temp/Event.ts +7669 -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 +39 -0
  53. package/src/metrics.js +25 -27
  54. package/src/metrics.types.ts +132 -0
  55. package/src/new-metrics.ts +167 -0
  56. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +235 -0
  57. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +199 -0
  58. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +722 -0
  59. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +76 -0
  60. package/test/unit/spec/metrics.js +65 -97
  61. package/test/unit/spec/new-metrics.ts +88 -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
@@ -0,0 +1,308 @@
1
+ /* eslint-disable class-methods-use-this */
2
+ /* eslint-disable valid-jsdoc */
3
+
4
+ import {MetricEventNames} from '../metrics.types';
5
+
6
+ // we only care about client event and feature event for now
7
+
8
+ /**
9
+ * @description Helper class to store latencies timestamp and to calculate various latencies for CA.
10
+ * @exports
11
+ * @class CallDiagnosticLatencies
12
+ */
13
+ export default class CallDiagnosticLatencies {
14
+ latencyTimestamps: Map<MetricEventNames, number>;
15
+
16
+ /**
17
+ * @constructor
18
+ */
19
+ constructor() {
20
+ this.latencyTimestamps = new Map();
21
+ }
22
+
23
+ /**
24
+ * Clear timestamps
25
+ */
26
+ public clearTimestamps() {
27
+ this.latencyTimestamps.clear();
28
+ }
29
+
30
+ /**
31
+ * Store timestamp value
32
+ * @param key - key
33
+ * @param value -value
34
+ * @throws
35
+ * @returns
36
+ */
37
+ public saveTimestamp(key: MetricEventNames, value: number = new Date().getTime()) {
38
+ this.latencyTimestamps.set(key, value);
39
+ }
40
+
41
+ /**
42
+ * Helper to calculate end - start
43
+ * @param a start
44
+ * @param b end
45
+ * @returns latency
46
+ */
47
+ public getDiffBetweenTimestamps(a: MetricEventNames, b: MetricEventNames) {
48
+ const start = this.latencyTimestamps.get(a);
49
+ const end = this.latencyTimestamps.get(b);
50
+ if (start && end) {
51
+ return end - start;
52
+ }
53
+
54
+ return undefined;
55
+ }
56
+
57
+ /**
58
+ * Meeting Info Request
59
+ * @note Meeting Info request happen not just in the join phase. CA requires
60
+ * metrics around meeting info request that are only part of join phase.
61
+ * This internal.* event is used to track the real timestamps
62
+ * (when the actual request/response happen). This is because the actual CA event is
63
+ * sent inside the join method on the meeting object based on some logic, but that's not exactly when
64
+ * those events are actually fired. The logic only confirms that they have happened, and we send them over.
65
+ * @returns - latency
66
+ */
67
+ public getMeetingInfoReqResp() {
68
+ return this.getDiffBetweenTimestamps(
69
+ 'internal.client.meetinginfo.request',
70
+ 'internal.client.meetinginfo.response'
71
+ );
72
+ }
73
+
74
+ /**
75
+ * Interstitial Time
76
+ * @returns - latency
77
+ */
78
+ public getShowInterstitialTime() {
79
+ return this.getDiffBetweenTimestamps(
80
+ 'internal.client.interstitial-window.launched',
81
+ 'internal.client.interstitial-window.click.joinbutton'
82
+ );
83
+ }
84
+
85
+ /**
86
+ * Call Init Join Request
87
+ * @returns - latency
88
+ */
89
+ public getCallInitJoinReq() {
90
+ return this.getDiffBetweenTimestamps(
91
+ 'internal.client.meeting.click.joinbutton',
92
+ 'client.locus.join.request'
93
+ );
94
+ }
95
+
96
+ /**
97
+ * Locus Join Request
98
+ * @returns - latency
99
+ */
100
+ public getJoinReqResp() {
101
+ return this.getDiffBetweenTimestamps('client.locus.join.request', 'client.locus.join.response');
102
+ }
103
+
104
+ /**
105
+ * Locus Join Response Sent Received
106
+ * @returns - latency
107
+ */
108
+ public getJoinRespSentReceived() {
109
+ // TODO: not clear SPARK-440554
110
+ return undefined;
111
+ }
112
+
113
+ /**
114
+ * Local SDP Generated Remote SDP REceived
115
+ * @returns - latency
116
+ */
117
+ public getLocalSDPGenRemoteSDPRecv() {
118
+ return this.getDiffBetweenTimestamps(
119
+ 'client.media-engine.local-sdp-generated',
120
+ 'client.media-engine.remote-sdp-received'
121
+ );
122
+ }
123
+
124
+ /**
125
+ * ICE Setup Time
126
+ * @returns - latency
127
+ */
128
+ public getICESetupTime() {
129
+ return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');
130
+ }
131
+
132
+ /**
133
+ * Audio ICE time
134
+ * @returns - latency
135
+ */
136
+ public getAudioICESetupTime() {
137
+ return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');
138
+ }
139
+
140
+ /**
141
+ * Video ICE Time
142
+ * @returns - latency
143
+ */
144
+ public getVideoICESetupTime() {
145
+ return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');
146
+ }
147
+
148
+ /**
149
+ * Share ICE Time
150
+ * @returns - latency
151
+ */
152
+ public getShareICESetupTime() {
153
+ return this.getDiffBetweenTimestamps('client.ice.start', 'client.ice.end');
154
+ }
155
+
156
+ /**
157
+ * Stay Lobby Time
158
+ * @returns - latency
159
+ */
160
+ public getStayLobbyTime() {
161
+ return this.getDiffBetweenTimestamps(
162
+ 'client.locus.join.response',
163
+ 'internal.host.meeting.participant.admitted'
164
+ );
165
+ }
166
+
167
+ /**
168
+ * Page JMT
169
+ * @returns - latency
170
+ */
171
+ public getPageJMT() {
172
+ return this.latencyTimestamps.get('internal.client.pageJMT.received') || undefined;
173
+ }
174
+
175
+ /**
176
+ * Click To Interstitial
177
+ * @returns - latency
178
+ */
179
+ public getClickToInterstitial() {
180
+ return this.getDiffBetweenTimestamps(
181
+ 'internal.client.meeting.click.joinbutton',
182
+ 'internal.client.meeting.interstitial-window.showed'
183
+ );
184
+ }
185
+
186
+ /**
187
+ * Interstitial To Join Ok
188
+ * @returns - latency
189
+ */
190
+ public getInterstitialToJoinOK() {
191
+ return this.getDiffBetweenTimestamps(
192
+ 'internal.client.meeting.click.joinbutton',
193
+ 'client.locus.join.response'
194
+ );
195
+ }
196
+
197
+ /**
198
+ * Interstitial To Media Ok
199
+ * @returns - latency
200
+ */
201
+ public getInterstitialToMediaOK() {
202
+ return this.getDiffBetweenTimestamps(
203
+ 'internal.client.meeting.click.joinbutton',
204
+ 'sdk.media-flow.started'
205
+ );
206
+ }
207
+
208
+ /**
209
+ * Total JMT
210
+ * @returns - latency
211
+ */
212
+ public getTotalJMT() {
213
+ const clickToInterstitial = this.getClickToInterstitial();
214
+ const interstitialToJoinOk = this.getInterstitialToJoinOK();
215
+
216
+ if (clickToInterstitial && interstitialToJoinOk) {
217
+ return clickToInterstitial + interstitialToJoinOk;
218
+ }
219
+
220
+ return undefined;
221
+ }
222
+
223
+ /**
224
+ * Join Conf JMT
225
+ * @returns - latency
226
+ */
227
+ public getJoinConfJMT() {
228
+ const joinReqResp = this.getJoinReqResp();
229
+ const ICESetupTime = this.getICESetupTime();
230
+
231
+ if (joinReqResp && ICESetupTime) {
232
+ return joinReqResp + ICESetupTime;
233
+ }
234
+
235
+ return undefined;
236
+ }
237
+
238
+ /**
239
+ * Total Media JMT
240
+ * @returns - latency
241
+ */
242
+ public getTotalMediaJMT() {
243
+ const clickToInterstitial = this.getClickToInterstitial();
244
+ const interstitialToJoinOk = this.getInterstitialToJoinOK();
245
+ const joinConfJMT = this.getJoinConfJMT();
246
+ const stayLobbyTime = this.getStayLobbyTime() || 0;
247
+
248
+ if (clickToInterstitial && interstitialToJoinOk && joinConfJMT) {
249
+ return clickToInterstitial + interstitialToJoinOk + joinConfJMT - stayLobbyTime;
250
+ }
251
+
252
+ return undefined;
253
+ }
254
+
255
+ /**
256
+ * Client JMT
257
+ * @returns - latency
258
+ */
259
+ public getClientJMT() {
260
+ const interstitialToJoinOk = this.getInterstitialToJoinOK();
261
+ const joinConfJMT = this.getJoinConfJMT();
262
+
263
+ if (interstitialToJoinOk && joinConfJMT) {
264
+ return interstitialToJoinOk + joinConfJMT;
265
+ }
266
+
267
+ return undefined;
268
+ }
269
+
270
+ /**
271
+ * Interstitial To Media OK JMT
272
+ * @returns - latency
273
+ */
274
+ public getInterstitialToMediaOKJMT() {
275
+ return this.getDiffBetweenTimestamps(
276
+ 'internal.client.interstitial-window.click.joinbutton',
277
+ 'client.media-engine.ready'
278
+ );
279
+ }
280
+
281
+ /**
282
+ * Audio setup delay receive
283
+ */
284
+ public getAudioJoinRespRxStart() {
285
+ return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');
286
+ }
287
+
288
+ /**
289
+ * Video setup delay receive
290
+ */
291
+ public getVideoJoinRespRxStart() {
292
+ return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.rx.start');
293
+ }
294
+
295
+ /**
296
+ * Audio setup delay transmit
297
+ */
298
+ public getAudioJoinRespTxStart() {
299
+ return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');
300
+ }
301
+
302
+ /**
303
+ * Video setup delay transmit
304
+ */
305
+ public getVideoJoinRespTxStart() {
306
+ return this.getDiffBetweenTimestamps('client.locus.join.response', 'client.media.tx.start');
307
+ }
308
+ }