@webex/internal-plugin-metrics 3.0.0-beta.162 → 3.0.0-beta.164
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/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +132 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +329 -0
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.js +511 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +106 -0
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
- package/dist/call-diagnostic/config.js +461 -0
- package/dist/call-diagnostic/config.js.map +1 -0
- package/dist/call-diagnostic/generated-types-temp/ClientEvent.js +7 -0
- package/dist/call-diagnostic/generated-types-temp/ClientEvent.js.map +1 -0
- package/dist/call-diagnostic/generated-types-temp/Event.js +7 -0
- package/dist/call-diagnostic/generated-types-temp/Event.js.map +1 -0
- package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js +7 -0
- package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +2 -11
- package/dist/metrics.js.map +1 -1
- package/dist/metrics.types.js +7 -0
- package/dist/metrics.types.js.map +1 -0
- package/dist/new-metrics.js +171 -0
- package/dist/new-metrics.js.map +1 -0
- package/dist/types/batcher.d.ts +2 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics-batcher.d.ts +2 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +149 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +324 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +31 -0
- package/dist/types/call-diagnostic/config.d.ts +57 -0
- package/dist/types/call-diagnostic/generated-types-temp/ClientEvent.d.ts +1112 -0
- package/dist/types/call-diagnostic/generated-types-temp/Event.d.ts +4851 -0
- package/dist/types/call-diagnostic/generated-types-temp/MediaQualityEvent.d.ts +2121 -0
- package/dist/types/client-metrics-batcher.d.ts +2 -0
- package/dist/types/config.d.ts +35 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/metrics.d.ts +3 -0
- package/dist/types/metrics.types.d.ts +89 -0
- package/dist/types/new-metrics.d.ts +83 -0
- package/package.json +12 -8
- package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +145 -0
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +297 -0
- package/src/call-diagnostic/call-diagnostic-metrics.ts +528 -0
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +102 -0
- package/src/call-diagnostic/config.ts +455 -0
- package/src/call-diagnostic/generated-types-temp/ClientEvent.ts +2357 -0
- package/src/call-diagnostic/generated-types-temp/Event.ts +7669 -0
- package/src/call-diagnostic/generated-types-temp/MediaQualityEvent.ts +2321 -0
- package/src/index.ts +39 -0
- package/src/metrics.js +0 -11
- package/src/metrics.types.ts +132 -0
- package/src/new-metrics.ts +167 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +233 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +193 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +722 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +76 -0
- package/test/unit/spec/metrics.js +2 -96
- package/test/unit/spec/new-metrics.ts +88 -0
- package/tsconfig.json +6 -0
- package/dist/call-diagnostic-events-batcher.js +0 -60
- package/dist/call-diagnostic-events-batcher.js.map +0 -1
- package/src/call-diagnostic-events-batcher.js +0 -62
- package/src/index.js +0 -17
- package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
SubmitBehavioralEvent,
|
|
15
|
+
SubmitClientEvent,
|
|
16
|
+
SubmitInternalEvent,
|
|
17
|
+
SubmitOperationalEvent,
|
|
18
|
+
SubmitMQE,
|
|
19
|
+
} from './metrics.types';
|
|
20
|
+
import * as CALL_DIAGNOSTIC_CONFIG from './call-diagnostic/config';
|
|
21
|
+
|
|
22
|
+
registerInternalPlugin('metrics', Metrics, {
|
|
23
|
+
config,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
registerInternalPlugin('newMetrics', NewMetrics, {
|
|
27
|
+
config,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export {default, getOSNameInternal} from './metrics';
|
|
31
|
+
export {config, CALL_DIAGNOSTIC_CONFIG, NewMetrics};
|
|
32
|
+
export type {
|
|
33
|
+
ClientEvent,
|
|
34
|
+
SubmitBehavioralEvent,
|
|
35
|
+
SubmitClientEvent,
|
|
36
|
+
SubmitInternalEvent,
|
|
37
|
+
SubmitMQE,
|
|
38
|
+
SubmitOperationalEvent,
|
|
39
|
+
};
|
package/src/metrics.js
CHANGED
|
@@ -10,7 +10,6 @@ import {OS_NAME, OSMap, CLIENT_NAME} from './config';
|
|
|
10
10
|
|
|
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
|
|
|
@@ -38,7 +37,6 @@ const Metrics = WebexPlugin.extend({
|
|
|
38
37
|
children: {
|
|
39
38
|
batcher: Batcher,
|
|
40
39
|
clientMetricsBatcher: ClientMetricsBatcher,
|
|
41
|
-
callDiagnosticEventsBatcher: CallDiagnosticEventsBatcher,
|
|
42
40
|
},
|
|
43
41
|
|
|
44
42
|
namespace: 'Metrics',
|
|
@@ -163,15 +161,6 @@ const Metrics = WebexPlugin.extend({
|
|
|
163
161
|
})
|
|
164
162
|
);
|
|
165
163
|
},
|
|
166
|
-
|
|
167
|
-
submitCallDiagnosticEvents(payload) {
|
|
168
|
-
const event = {
|
|
169
|
-
type: 'diagnostic-event',
|
|
170
|
-
eventPayload: payload,
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
return this.callDiagnosticEventsBatcher.request(event);
|
|
174
|
-
},
|
|
175
164
|
});
|
|
176
165
|
|
|
177
166
|
export default Metrics;
|
|
@@ -0,0 +1,132 @@
|
|
|
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.pageJMT.received'
|
|
33
|
+
| 'internal.client.interstitial-window.click.joinbutton';
|
|
34
|
+
payload?: never;
|
|
35
|
+
options?: never;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export interface ClientEvent {
|
|
39
|
+
name: RawClientEvent['name'];
|
|
40
|
+
payload?: RawClientEvent;
|
|
41
|
+
options: SubmitClientEventOptions;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface BehavioralEvent {
|
|
45
|
+
// TODO: not implemented
|
|
46
|
+
name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';
|
|
47
|
+
payload?: never;
|
|
48
|
+
options?: never;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OperationalEvent {
|
|
52
|
+
// TODO: not implemented
|
|
53
|
+
name: never;
|
|
54
|
+
payload?: never;
|
|
55
|
+
options?: never;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface FeatureEvent {
|
|
59
|
+
// TODO: not implemented
|
|
60
|
+
name: never;
|
|
61
|
+
payload?: never;
|
|
62
|
+
options?: never;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface MediaQualityEvent {
|
|
66
|
+
name: RawMediaQualityEvent['name'];
|
|
67
|
+
payload?: RawMediaQualityEvent;
|
|
68
|
+
options: SubmitMQEOptions;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type RecursivePartial<T> = {
|
|
72
|
+
[P in keyof T]?: T[P] extends (infer U)[]
|
|
73
|
+
? RecursivePartial<U>[]
|
|
74
|
+
: T[P] extends object
|
|
75
|
+
? RecursivePartial<T[P]>
|
|
76
|
+
: T[P];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type MetricEventNames =
|
|
80
|
+
| InternalEvent['name']
|
|
81
|
+
| ClientEvent['name']
|
|
82
|
+
| BehavioralEvent['name']
|
|
83
|
+
| OperationalEvent['name']
|
|
84
|
+
| FeatureEvent['name']
|
|
85
|
+
| MediaQualityEvent['name'];
|
|
86
|
+
|
|
87
|
+
export type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];
|
|
88
|
+
export type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];
|
|
89
|
+
export type NetworkType = RawEvent['origin']['networkType'];
|
|
90
|
+
|
|
91
|
+
export type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;
|
|
92
|
+
|
|
93
|
+
export type MediaQualityEventAudioSetupDelayPayload =
|
|
94
|
+
MediaQualityEvent['payload']['audioSetupDelay'];
|
|
95
|
+
export type MediaQualityEventVideoSetupDelayPayload =
|
|
96
|
+
MediaQualityEvent['payload']['videoSetupDelay'];
|
|
97
|
+
|
|
98
|
+
export type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {
|
|
99
|
+
intervals: MediaQualityEvent['payload']['intervals'];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type SubmitInternalEvent = (args: {
|
|
103
|
+
name: InternalEvent['name'];
|
|
104
|
+
payload?: RecursivePartial<InternalEvent['payload']>;
|
|
105
|
+
options: any;
|
|
106
|
+
}) => void;
|
|
107
|
+
|
|
108
|
+
export type SubmitBehavioralEvent = (args: {
|
|
109
|
+
name: BehavioralEvent['name'];
|
|
110
|
+
payload?: RecursivePartial<BehavioralEvent['payload']>;
|
|
111
|
+
options: any;
|
|
112
|
+
}) => void;
|
|
113
|
+
|
|
114
|
+
export type SubmitClientEvent = (args: {
|
|
115
|
+
name: ClientEvent['name'];
|
|
116
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
117
|
+
options: SubmitClientEventOptions;
|
|
118
|
+
}) => void;
|
|
119
|
+
|
|
120
|
+
export type SubmitOperationalEvent = (args: {
|
|
121
|
+
name: OperationalEvent['name'];
|
|
122
|
+
payload?: RecursivePartial<OperationalEvent['payload']>;
|
|
123
|
+
options: any;
|
|
124
|
+
}) => void;
|
|
125
|
+
|
|
126
|
+
export type SubmitMQE = (args: {
|
|
127
|
+
name: MediaQualityEvent['name'];
|
|
128
|
+
payload: RecursivePartial<MediaQualityEvent['payload']> & {
|
|
129
|
+
intervals: MediaQualityEvent['payload']['intervals'];
|
|
130
|
+
};
|
|
131
|
+
options: any;
|
|
132
|
+
}) => void;
|
|
@@ -0,0 +1,167 @@
|
|
|
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
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Metrics plugin to centralize all types of metrics.
|
|
23
|
+
* @class
|
|
24
|
+
*/
|
|
25
|
+
class Metrics extends WebexPlugin {
|
|
26
|
+
// eslint-disable-next-line no-use-before-define
|
|
27
|
+
static instance: Metrics;
|
|
28
|
+
|
|
29
|
+
// Call Diagnostic latencies
|
|
30
|
+
callDiagnosticLatencies: CallDiagnosticLatencies;
|
|
31
|
+
// Helper classes to handle the different types of metrics
|
|
32
|
+
callDiagnosticMetrics: CallDiagnosticMetrics;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Constructor
|
|
36
|
+
* @param args
|
|
37
|
+
* @constructor
|
|
38
|
+
* @private
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
constructor(...args) {
|
|
42
|
+
super(...args);
|
|
43
|
+
|
|
44
|
+
this.callDiagnosticLatencies = new CallDiagnosticLatencies();
|
|
45
|
+
|
|
46
|
+
this.onReady();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* On Ready
|
|
51
|
+
*/
|
|
52
|
+
private onReady() {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
this.webex.once('ready', () => {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Used for internal purposes only
|
|
62
|
+
* @param args
|
|
63
|
+
*/
|
|
64
|
+
submitInternalEvent({
|
|
65
|
+
name,
|
|
66
|
+
payload,
|
|
67
|
+
options,
|
|
68
|
+
}: {
|
|
69
|
+
name: InternalEvent['name'];
|
|
70
|
+
payload?: RecursivePartial<InternalEvent['payload']>;
|
|
71
|
+
options: any;
|
|
72
|
+
}) {
|
|
73
|
+
if (name === 'internal.reset.join.latencies') {
|
|
74
|
+
this.callDiagnosticLatencies.clearTimestamps();
|
|
75
|
+
} else {
|
|
76
|
+
this.callDiagnosticLatencies.saveTimestamp(name);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Behavioral event
|
|
82
|
+
* @param args
|
|
83
|
+
*/
|
|
84
|
+
submitBehavioralEvent({
|
|
85
|
+
name,
|
|
86
|
+
payload,
|
|
87
|
+
options,
|
|
88
|
+
}: {
|
|
89
|
+
name: BehavioralEvent['name'];
|
|
90
|
+
payload?: RecursivePartial<BehavioralEvent['payload']>;
|
|
91
|
+
options: any;
|
|
92
|
+
}) {
|
|
93
|
+
this.callDiagnosticLatencies.saveTimestamp(name);
|
|
94
|
+
throw new Error('Not implemented.');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Operational event
|
|
99
|
+
* @param args
|
|
100
|
+
*/
|
|
101
|
+
submitOperationalEvent({
|
|
102
|
+
name,
|
|
103
|
+
payload,
|
|
104
|
+
options,
|
|
105
|
+
}: {
|
|
106
|
+
name: OperationalEvent['name'];
|
|
107
|
+
payload?: RecursivePartial<OperationalEvent['payload']>;
|
|
108
|
+
options: any;
|
|
109
|
+
}) {
|
|
110
|
+
throw new Error('Not implemented.');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Call Analyzer: Media Quality Event
|
|
115
|
+
* @param args
|
|
116
|
+
*/
|
|
117
|
+
submitMQE({
|
|
118
|
+
name,
|
|
119
|
+
payload,
|
|
120
|
+
options,
|
|
121
|
+
}: {
|
|
122
|
+
name: MediaQualityEvent['name'];
|
|
123
|
+
payload: RecursivePartial<MediaQualityEvent['payload']> & {
|
|
124
|
+
intervals: MediaQualityEvent['payload']['intervals'];
|
|
125
|
+
};
|
|
126
|
+
options: any;
|
|
127
|
+
}) {
|
|
128
|
+
this.callDiagnosticLatencies.saveTimestamp(name);
|
|
129
|
+
this.callDiagnosticMetrics.submitMQE({name, payload, options});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Call Analyzer: Feature Usage Event
|
|
134
|
+
* @param args
|
|
135
|
+
*/
|
|
136
|
+
submitFeatureEvent({
|
|
137
|
+
name,
|
|
138
|
+
payload,
|
|
139
|
+
options,
|
|
140
|
+
}: {
|
|
141
|
+
name: FeatureEvent['name'];
|
|
142
|
+
payload?: RecursivePartial<FeatureEvent['payload']>;
|
|
143
|
+
options: any;
|
|
144
|
+
}) {
|
|
145
|
+
throw new Error('Not implemented.');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Call Analyzer: Client Event
|
|
150
|
+
* @public
|
|
151
|
+
* @param args
|
|
152
|
+
*/
|
|
153
|
+
public submitClientEvent({
|
|
154
|
+
name,
|
|
155
|
+
payload,
|
|
156
|
+
options,
|
|
157
|
+
}: {
|
|
158
|
+
name: ClientEvent['name'];
|
|
159
|
+
payload?: RecursivePartial<ClientEvent['payload']>;
|
|
160
|
+
options: SubmitClientEventOptions;
|
|
161
|
+
}) {
|
|
162
|
+
this.callDiagnosticLatencies.saveTimestamp(name);
|
|
163
|
+
this.callDiagnosticMetrics.submitClientEvent({name, payload, options});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export default Metrics;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import {config} from '@webex/internal-plugin-metrics';
|
|
7
|
+
import MockWebex from '@webex/test-helper-mock-webex';
|
|
8
|
+
import sinon from 'sinon';
|
|
9
|
+
import {NewMetrics} from '@webex/internal-plugin-metrics';
|
|
10
|
+
const flushPromises = () => new Promise(setImmediate);
|
|
11
|
+
|
|
12
|
+
describe('plugin-metrics', () => {
|
|
13
|
+
describe('CallDiagnosticEventsBatcher', () => {
|
|
14
|
+
let webex;
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
webex = new MockWebex({
|
|
19
|
+
children: {
|
|
20
|
+
newMetrics: NewMetrics
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
webex.request = (options) => Promise.resolve({body: {items: []}, options});
|
|
25
|
+
sinon.spy(webex, 'request');
|
|
26
|
+
|
|
27
|
+
webex.emit("ready");
|
|
28
|
+
|
|
29
|
+
webex.config.metrics = config.metrics;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
sinon.restore();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('#request()', () => {
|
|
37
|
+
describe('when the request completes successfully', async () => {
|
|
38
|
+
it('clears the queue', async () => {
|
|
39
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
{event: {name: 'client.interstitial-window.launched'}}
|
|
42
|
+
);
|
|
43
|
+
await flushPromises();
|
|
44
|
+
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
assert.calledOnce(webex.request);
|
|
47
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('doesnt include any joinTimes for other events', async () => {
|
|
51
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
52
|
+
//@ts-ignore
|
|
53
|
+
{event: {name: 'client.alert.displayed'}}
|
|
54
|
+
);
|
|
55
|
+
await flushPromises();
|
|
56
|
+
|
|
57
|
+
//@ts-ignore
|
|
58
|
+
assert.calledOnce(webex.request);
|
|
59
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
60
|
+
name: 'client.alert.displayed',
|
|
61
|
+
});
|
|
62
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('appends the correct join times to the request for client.interstitial-window.launched', async () => {
|
|
66
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
67
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
68
|
+
//@ts-ignore
|
|
69
|
+
{event: {name: 'client.interstitial-window.launched'}}
|
|
70
|
+
);
|
|
71
|
+
await flushPromises();
|
|
72
|
+
|
|
73
|
+
//@ts-ignore
|
|
74
|
+
assert.calledOnce(webex.request);
|
|
75
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
76
|
+
name: 'client.interstitial-window.launched',
|
|
77
|
+
joinTimes: {
|
|
78
|
+
clickToInterstitial: 10,
|
|
79
|
+
meetingInfoReqResp: 10,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('appends the correct join times to the request for client.call.initiated', async () => {
|
|
86
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
87
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
88
|
+
//@ts-ignore
|
|
89
|
+
{event: {name: 'client.call.initiated'}}
|
|
90
|
+
);
|
|
91
|
+
await flushPromises();
|
|
92
|
+
|
|
93
|
+
//@ts-ignore
|
|
94
|
+
assert.calledOnce(webex.request);
|
|
95
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
96
|
+
name: 'client.call.initiated',
|
|
97
|
+
joinTimes: {
|
|
98
|
+
meetingInfoReqResp: 10,
|
|
99
|
+
showInterstitialTime: 10,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('appends the correct join times to the request for client.locus.join.response', async () => {
|
|
106
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
107
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getJoinRespSentReceived = sinon.stub().returns(20);
|
|
108
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getPageJMT = sinon.stub().returns(30);
|
|
109
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
110
|
+
//@ts-ignore
|
|
111
|
+
{event: {name: 'client.locus.join.response'}}
|
|
112
|
+
);
|
|
113
|
+
await flushPromises();
|
|
114
|
+
|
|
115
|
+
//@ts-ignore
|
|
116
|
+
assert.calledOnce(webex.request);
|
|
117
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
118
|
+
name: 'client.locus.join.response',
|
|
119
|
+
joinTimes: {
|
|
120
|
+
callInitJoinReq: 10,
|
|
121
|
+
clickToInterstitial: 10,
|
|
122
|
+
interstitialToJoinOK: 10,
|
|
123
|
+
joinReqResp: 10,
|
|
124
|
+
joinReqSentReceived: 20,
|
|
125
|
+
meetingInfoReqResp: 10,
|
|
126
|
+
pageJmt: 30,
|
|
127
|
+
totalJmt: 20,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('appends the correct join times to the request for client.ice.end', async () => {
|
|
134
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
135
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
136
|
+
//@ts-ignore
|
|
137
|
+
{event: {name: 'client.ice.end'}}
|
|
138
|
+
);
|
|
139
|
+
await flushPromises();
|
|
140
|
+
|
|
141
|
+
//@ts-ignore
|
|
142
|
+
assert.calledOnce(webex.request);
|
|
143
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
144
|
+
name: 'client.ice.end',
|
|
145
|
+
joinTimes: {
|
|
146
|
+
ICESetupTime: 10,
|
|
147
|
+
audioICESetupTime: 10,
|
|
148
|
+
shareICESetupTime: 10,
|
|
149
|
+
videoICESetupTime: 10,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('appends the correct join times to the request for client.media.rx.start', async () => {
|
|
156
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
157
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
158
|
+
//@ts-ignore
|
|
159
|
+
{event: {name: 'client.media.rx.start'}}
|
|
160
|
+
);
|
|
161
|
+
await flushPromises();
|
|
162
|
+
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
assert.calledOnce(webex.request);
|
|
165
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
166
|
+
name: 'client.media.rx.start',
|
|
167
|
+
joinTimes: {
|
|
168
|
+
localSDPGenRemoteSDPRecv: 10,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('appends the correct join times to the request for client.media-engine.ready', async () => {
|
|
175
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10)
|
|
176
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
177
|
+
//@ts-ignore
|
|
178
|
+
{event: {name: 'client.media-engine.ready'}}
|
|
179
|
+
);
|
|
180
|
+
await flushPromises();
|
|
181
|
+
|
|
182
|
+
//@ts-ignore
|
|
183
|
+
assert.calledOnce(webex.request);
|
|
184
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
185
|
+
name: 'client.media-engine.ready',
|
|
186
|
+
joinTimes: {
|
|
187
|
+
totalMediaJMT: 30,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('appends the correct audio and video setup delays to the request for client.mediaquality.event', async () => {
|
|
194
|
+
webex.internal.newMetrics.callDiagnosticLatencies.getDiffBetweenTimestamps = sinon.stub().returns(10);
|
|
195
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
196
|
+
//@ts-ignore
|
|
197
|
+
{event: {name: 'client.mediaquality.event'}}
|
|
198
|
+
);
|
|
199
|
+
await flushPromises();
|
|
200
|
+
|
|
201
|
+
//@ts-ignore
|
|
202
|
+
assert.calledOnce(webex.request);
|
|
203
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event, {
|
|
204
|
+
name: 'client.mediaquality.event',
|
|
205
|
+
audioSetupDelay: {
|
|
206
|
+
joinRespRxStart: 10,
|
|
207
|
+
joinRespTxStart: 10,
|
|
208
|
+
},
|
|
209
|
+
videoSetupDelay: {
|
|
210
|
+
joinRespRxStart: 10,
|
|
211
|
+
joinRespTxStart: 10,
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('doesnt include audioSetup and videoSetup delays for other events', async () => {
|
|
218
|
+
await webex.internal.newMetrics.callDiagnosticMetrics.submitToCallDiagnostics(
|
|
219
|
+
//@ts-ignore
|
|
220
|
+
{event: {name: 'client.alert.displayed'}}
|
|
221
|
+
);
|
|
222
|
+
await flushPromises();
|
|
223
|
+
|
|
224
|
+
//@ts-ignore
|
|
225
|
+
assert.calledOnce(webex.request);
|
|
226
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event.audioSetupDelay, undefined);
|
|
227
|
+
assert.deepEqual(webex.request.getCalls()[0].args[0].body.metrics[0].eventPayload.event.videoSetupDelay, undefined);
|
|
228
|
+
assert.lengthOf(webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.queue, 0);
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|