@observertc/client-monitor-js 2.2.2 → 3.0.0
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 +79 -190
- package/lib/ClientMetaData.d.ts +27 -0
- package/lib/ClientMetaData.d.ts.map +1 -0
- package/lib/ClientMetaData.js +119 -0
- package/lib/ClientMonitor.d.ts +101 -339
- package/lib/ClientMonitor.d.ts.map +1 -1
- package/lib/ClientMonitor.js +224 -0
- package/lib/Collectors.d.ts +46 -52
- package/lib/Collectors.d.ts.map +1 -1
- package/lib/Collectors.js +166 -222
- package/lib/Detectors.d.ts +37 -0
- package/lib/Detectors.d.ts.map +1 -0
- package/lib/Detectors.js +115 -0
- package/lib/Sampler.d.ts +7 -28
- package/lib/Sampler.d.ts.map +1 -1
- package/lib/Sampler.js +354 -266
- package/lib/collectors/Adapter.d.ts +14 -0
- package/lib/collectors/Adapter.d.ts.map +1 -0
- package/lib/collectors/Adapter.js +57 -0
- package/lib/collectors/MediasoupStatsCollector.d.ts +18 -40
- package/lib/collectors/MediasoupStatsCollector.d.ts.map +1 -1
- package/lib/collectors/MediasoupStatsCollector.js +273 -376
- package/lib/collectors/MediasoupSurrogates.d.ts +65 -31
- package/lib/collectors/MediasoupSurrogates.d.ts.map +1 -1
- package/lib/collectors/PeerConnectionStatsCollector.d.ts +18 -16
- package/lib/collectors/PeerConnectionStatsCollector.d.ts.map +1 -1
- package/lib/collectors/PeerConnectionStatsCollector.js +106 -36
- package/lib/collectors/StatsCollector.d.ts +1 -18
- package/lib/collectors/StatsCollector.d.ts.map +1 -1
- package/lib/collectors/StatsProvider.d.ts +7 -0
- package/lib/collectors/StatsProvider.d.ts.map +1 -0
- package/lib/collectors/StatsProvider.js +11 -0
- package/lib/collectors/browserAdapterMiddlewares.d.ts +5 -0
- package/lib/collectors/browserAdapterMiddlewares.d.ts.map +1 -0
- package/lib/collectors/browserAdapterMiddlewares.js +75 -0
- package/lib/collectors/utils.d.ts +16 -0
- package/lib/collectors/utils.d.ts.map +1 -0
- package/lib/collectors/utils.js +73 -0
- package/lib/detectors/AudioDesyncDetector.d.ts +11 -7
- package/lib/detectors/AudioDesyncDetector.d.ts.map +1 -1
- package/lib/detectors/AudioDesyncDetector.js +38 -26
- package/lib/detectors/CongestionDetector.d.ts +18 -13
- package/lib/detectors/CongestionDetector.d.ts.map +1 -1
- package/lib/detectors/CongestionDetector.js +59 -38
- package/lib/detectors/{CpuIssueDetector.d.ts → CpuPerformanceDetector.d.ts} +10 -9
- package/lib/detectors/CpuPerformanceDetector.d.ts.map +1 -0
- package/lib/detectors/CpuPerformanceDetector.js +58 -0
- package/lib/entries/InboundTrackStats.d.ts +25 -0
- package/lib/entries/InboundTrackStats.d.ts.map +1 -0
- package/lib/entries/InboundTrackStats.js +89 -0
- package/lib/entries/OutboundTrackStats.d.ts +18 -0
- package/lib/entries/OutboundTrackStats.d.ts.map +1 -0
- package/lib/entries/OutboundTrackStats.js +53 -0
- package/lib/entries/PeerConnectionEntryManifest.d.ts +113 -0
- package/lib/entries/PeerConnectionEntryManifest.d.ts.map +1 -0
- package/lib/entries/PeerConnectionEntryManifest.js +936 -0
- package/lib/entries/StatsEntryInterfaces.d.ts +77 -94
- package/lib/entries/StatsEntryInterfaces.d.ts.map +1 -1
- package/lib/entries/StatsStorage.d.ts +73 -152
- package/lib/entries/StatsStorage.d.ts.map +1 -1
- package/lib/entries/StatsStorage.js +360 -291
- package/lib/entries/UpdateFields.d.ts +0 -5
- package/lib/entries/UpdateFields.d.ts.map +1 -1
- package/lib/entries/UpdateFields.js +1 -47
- package/lib/index.d.ts +19 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -7
- package/lib/schema/Samples.d.ts +0 -206
- package/lib/schema/Samples.d.ts.map +1 -1
- package/lib/schema/W3cStatsIdentifiers.d.ts +156 -114
- package/lib/schema/W3cStatsIdentifiers.d.ts.map +1 -1
- package/lib/schema/W3cStatsIdentifiers.js +2 -32
- package/lib/utils/IndexedMap.d.ts +26 -0
- package/lib/utils/IndexedMap.d.ts.map +1 -0
- package/lib/utils/IndexedMap.js +219 -0
- package/lib/utils/Processor.d.ts +7 -0
- package/lib/utils/Processor.d.ts.map +1 -0
- package/lib/utils/Processor.js +38 -0
- package/lib/utils/Stats.d.ts +60 -0
- package/lib/utils/Stats.d.ts.map +1 -0
- package/lib/utils/Stats.js +205 -0
- package/lib/utils/Timer.d.ts +13 -25
- package/lib/utils/Timer.d.ts.map +1 -1
- package/lib/utils/Timer.js +82 -127
- package/lib/utils/TypedEmitter.d.ts +14 -0
- package/lib/utils/TypedEmitter.d.ts.map +1 -0
- package/lib/utils/TypedEmitter.js +37 -0
- package/lib/utils/callEvents.d.ts +23 -11
- package/lib/utils/callEvents.d.ts.map +1 -1
- package/lib/utils/callEvents.js +158 -13
- package/lib/utils/common.d.ts +9 -6
- package/lib/utils/common.d.ts.map +1 -1
- package/lib/utils/common.js +7 -76
- package/lib/utils/logger.d.ts +17 -9
- package/lib/utils/logger.d.ts.map +1 -1
- package/lib/utils/logger.js +81 -127
- package/package.json +7 -7
- package/src/ClientMetaData.ts +115 -0
- package/src/ClientMonitor.ts +216 -366
- package/src/Collectors.ts +195 -276
- package/src/Detectors.ts +134 -0
- package/src/Sampler.ts +350 -304
- package/src/collectors/Adapter.ts +75 -0
- package/src/collectors/MediasoupStatsCollector.ts +320 -440
- package/src/collectors/MediasoupSurrogates.ts +72 -37
- package/src/collectors/PeerConnectionStatsCollector.ts +131 -55
- package/src/collectors/StatsCollector.ts +2 -23
- package/src/collectors/StatsProvider.ts +15 -0
- package/src/collectors/browserAdapterMiddlewares.ts +74 -0
- package/src/collectors/utils.ts +118 -0
- package/src/detectors/AudioDesyncDetector.ts +47 -35
- package/src/detectors/CongestionDetector.ts +101 -82
- package/src/detectors/{CpuIssueDetector.ts → CpuPerformanceDetector.ts} +35 -25
- package/src/entries/InboundTrackStats.ts +99 -0
- package/src/entries/OutboundTrackStats.ts +58 -0
- package/src/entries/PeerConnectionEntryManifest.ts +1045 -0
- package/src/entries/StatsEntryInterfaces.ts +93 -107
- package/src/entries/StatsStorage.ts +381 -494
- package/src/entries/UpdateFields.ts +0 -58
- package/src/index.ts +45 -21
- package/src/schema/Samples.ts +0 -218
- package/src/schema/W3cStatsIdentifiers.ts +212 -134
- package/src/utils/IndexedMap.ts +237 -0
- package/src/utils/Processor.ts +37 -0
- package/src/utils/Stats.ts +252 -0
- package/src/utils/Timer.ts +91 -142
- package/src/utils/TypedEmitter.ts +50 -0
- package/src/utils/callEvents.ts +179 -12
- package/src/utils/common.ts +14 -74
- package/src/utils/logger.ts +101 -145
- package/lib/Accumulator.d.ts +0 -35
- package/lib/Accumulator.d.ts.map +0 -1
- package/lib/Accumulator.js +0 -68
- package/lib/ClientDevices.d.ts +0 -23
- package/lib/ClientDevices.d.ts.map +0 -1
- package/lib/ClientDevices.js +0 -124
- package/lib/ClientMonitorImpl.d.ts +0 -82
- package/lib/ClientMonitorImpl.d.ts.map +0 -1
- package/lib/ClientMonitorImpl.js +0 -484
- package/lib/Evaluators.d.ts +0 -14
- package/lib/Evaluators.d.ts.map +0 -1
- package/lib/Evaluators.js +0 -29
- package/lib/Metrics.d.ts +0 -39
- package/lib/Metrics.d.ts.map +0 -1
- package/lib/Metrics.js +0 -30
- package/lib/adapters/Adapter.d.ts +0 -17
- package/lib/adapters/Adapter.d.ts.map +0 -1
- package/lib/adapters/Adapter.js +0 -159
- package/lib/adapters/Chrome86Adapter.d.ts +0 -6
- package/lib/adapters/Chrome86Adapter.d.ts.map +0 -1
- package/lib/adapters/Chrome86Adapter.js +0 -71
- package/lib/adapters/DefaultAdapter.d.ts +0 -6
- package/lib/adapters/DefaultAdapter.d.ts.map +0 -1
- package/lib/adapters/DefaultAdapter.js +0 -22
- package/lib/adapters/Firefox94Adapter.d.ts +0 -6
- package/lib/adapters/Firefox94Adapter.d.ts.map +0 -1
- package/lib/adapters/Firefox94Adapter.js +0 -38
- package/lib/adapters/Safari14Adapter.d.ts +0 -6
- package/lib/adapters/Safari14Adapter.d.ts.map +0 -1
- package/lib/adapters/Safari14Adapter.js +0 -63
- package/lib/alterters/AudioDesyncAlerter.d.ts +0 -35
- package/lib/alterters/AudioDesyncAlerter.d.ts.map +0 -1
- package/lib/alterters/AudioDesyncAlerter.js +0 -66
- package/lib/detectors/CpuIssueDetector.d.ts.map +0 -1
- package/lib/detectors/CpuIssueDetector.js +0 -43
- package/lib/detectors/LowMoSDetector.d.ts +0 -29
- package/lib/detectors/LowMoSDetector.d.ts.map +0 -1
- package/lib/detectors/LowMoSDetector.js +0 -36
- package/lib/detectors/LowStabilityScoreDetector.d.ts +0 -21
- package/lib/detectors/LowStabilityScoreDetector.d.ts.map +0 -1
- package/lib/detectors/LowStabilityScoreDetector.js +0 -43
- package/lib/entries/PeerConnectionEntryImpl.d.ts +0 -85
- package/lib/entries/PeerConnectionEntryImpl.d.ts.map +0 -1
- package/lib/entries/PeerConnectionEntryImpl.js +0 -1055
- package/lib/utils/MediaDevices.d.ts +0 -14
- package/lib/utils/MediaDevices.d.ts.map +0 -1
- package/lib/utils/MediaDevices.js +0 -87
- package/lib/utils/StatsVisitor.d.ts +0 -31
- package/lib/utils/StatsVisitor.d.ts.map +0 -1
- package/lib/utils/StatsVisitor.js +0 -106
- package/lib/utils/makeStamp.d.ts +0 -2
- package/lib/utils/makeStamp.d.ts.map +0 -1
- package/lib/utils/makeStamp.js +0 -39
- package/lib/utils/reverseEnums.d.ts +0 -6
- package/lib/utils/reverseEnums.d.ts.map +0 -1
- package/lib/utils/reverseEnums.js +0 -12
- package/src/Accumulator.ts +0 -99
- package/src/ClientDevices.ts +0 -118
- package/src/ClientMonitorImpl.ts +0 -555
- package/src/Evaluators.ts +0 -40
- package/src/Metrics.ts +0 -66
- package/src/adapters/Adapter.ts +0 -158
- package/src/adapters/Chrome86Adapter.ts +0 -65
- package/src/adapters/DefaultAdapter.ts +0 -20
- package/src/adapters/Firefox94Adapter.ts +0 -39
- package/src/adapters/Safari14Adapter.ts +0 -58
- package/src/alterters/AudioDesyncAlerter.ts +0 -105
- package/src/detectors/LowMoSDetector.ts +0 -63
- package/src/detectors/LowStabilityScoreDetector.ts +0 -57
- package/src/entries/PeerConnectionEntryImpl.ts +0 -1151
- package/src/utils/MediaDevices.ts +0 -85
- package/src/utils/StatsVisitor.ts +0 -142
- package/src/utils/makeStamp.ts +0 -36
- package/src/utils/reverseEnums.ts +0 -18
package/README.md
CHANGED
|
@@ -8,7 +8,9 @@ Table of Contents:
|
|
|
8
8
|
* [Quick Start](#quick-start)
|
|
9
9
|
* [Integrations](#integrations)
|
|
10
10
|
- [Mediasoup](#mediasoup)
|
|
11
|
-
* [
|
|
11
|
+
* [Detectors and Alerts](#detectors-and-alerts)
|
|
12
|
+
- [Audio Desync Detector](#audio-desync-detector)
|
|
13
|
+
- [CPU Performance Detector](#cpu-performance-detector)
|
|
12
14
|
* [Calculated updates](#calculated-updates)
|
|
13
15
|
* [Configurations](#configurations)
|
|
14
16
|
* [NPM package](#npm-package)
|
|
@@ -70,7 +72,7 @@ const config = {
|
|
|
70
72
|
const monitor = createClientMonitor(config);
|
|
71
73
|
const mediasoupStatsCollector = monitor.collectors.collectFromMediasoupDevice(mediasoupDevice);
|
|
72
74
|
|
|
73
|
-
monitor.
|
|
75
|
+
monitor.on('stats-collected', () => {
|
|
74
76
|
// do your stuff
|
|
75
77
|
|
|
76
78
|
// you can close detach mediasoup
|
|
@@ -106,12 +108,11 @@ const monitor = createClientMonitor({
|
|
|
106
108
|
|
|
107
109
|
const storage = monitor.storage;
|
|
108
110
|
monitor.on('stats-collected', () => {
|
|
109
|
-
|
|
110
|
-
console.log('
|
|
111
|
-
console.log('Sending
|
|
112
|
-
console.log('
|
|
113
|
-
console.log('Receiving
|
|
114
|
-
console.log('Receiving video bitrate', updates.receivingVideoBitrate);
|
|
111
|
+
console.log('average RTT in seconds', storage.avgRttInS);
|
|
112
|
+
console.log('Sending audio bitrate', storage.sendingAudioBitrate);
|
|
113
|
+
console.log('Sending video bitrate', storage.sendingVideoBitrate);
|
|
114
|
+
console.log('Receiving audio bitrate', storage.receivingAudioBitrate);
|
|
115
|
+
console.log('Receiving video bitrate', storage.receivingVideoBitrate);
|
|
115
116
|
|
|
116
117
|
```
|
|
117
118
|
|
|
@@ -128,12 +129,11 @@ const monitor = createClientMonitor({
|
|
|
128
129
|
const storage = monitor.storage;
|
|
129
130
|
monitor.on('stats-collected', () => {
|
|
130
131
|
for (const peerConnection of storage.peerConnections()) {
|
|
131
|
-
|
|
132
|
-
console.log('
|
|
133
|
-
console.log('Sending
|
|
134
|
-
console.log('
|
|
135
|
-
console.log('Receiving
|
|
136
|
-
console.log('Receiving video bitrate on PC', updates.receivingVideoBitrate);
|
|
132
|
+
console.log('average RTT in seconds', peerConnection.avgRttInS);
|
|
133
|
+
console.log('Sending audio bitrate on PC', peerConnection.sendingAudioBitrate);
|
|
134
|
+
console.log('Sending video bitrate on PC', peerConnection.sendingVideoBitrate);
|
|
135
|
+
console.log('Receiving audio bitrate on PC', peerConnection.receivingAudioBitrate);
|
|
136
|
+
console.log('Receiving video bitrate on PC', peerConnection.receivingVideoBitrate);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
|
|
@@ -153,15 +153,12 @@ const storage = monitor.storage;
|
|
|
153
153
|
monitor.on('stats-collected', () => {
|
|
154
154
|
for (const inboundRtp of storage.inboundRtps()) {
|
|
155
155
|
|
|
156
|
-
console.log('mean opinion score for inbound-rtp', inboundRtp.
|
|
157
|
-
|
|
158
|
-
const updates = inboundRtp.updates;
|
|
159
|
-
console.log('receiving bitrate', updates.receivingBitrate);
|
|
160
|
-
console.log('lost packets since last stats-collected', updates.lostPackets);
|
|
161
|
-
console.log('received packets since last stats-collected', updates.receivedPackets);
|
|
162
|
-
console.log('decoded frames since last stats-collected', updates.decodedFrames);
|
|
156
|
+
console.log('mean opinion score for inbound-rtp', inboundRtp.score);
|
|
163
157
|
|
|
164
|
-
console.log('
|
|
158
|
+
console.log('receiving bitrate', inboundRtp.receivingBitrate);
|
|
159
|
+
console.log('lost packets since last stats-collected', inboundRtp.lostPackets);
|
|
160
|
+
console.log('received packets since last stats-collected', inboundRtp.receivedPackets);
|
|
161
|
+
console.log('decoded frames since last stats-collected', inboundRtp.decodedFrames);
|
|
165
162
|
}
|
|
166
163
|
});
|
|
167
164
|
|
|
@@ -181,35 +178,28 @@ const storage = monitor.storage;
|
|
|
181
178
|
monitor.on('stats-collected', () => {
|
|
182
179
|
for (const outboundRtp of storage.outboundRtps()) {
|
|
183
180
|
|
|
184
|
-
console.log('stability score outbound-rtp', outboundRtp.
|
|
181
|
+
console.log('stability score outbound-rtp', outboundRtp.score);
|
|
185
182
|
|
|
186
|
-
|
|
187
|
-
console.log('
|
|
188
|
-
console.log('sent packets since last stats-collected', updates.sentPackets);
|
|
183
|
+
console.log('sending bitrate', outboundRtp.sendingBitrate);
|
|
184
|
+
console.log('sent packets since last stats-collected', outboundRtp.sentPackets);
|
|
189
185
|
|
|
190
186
|
const remoteInboundRtp = outboundRtp.getRemoteInboundRtp();
|
|
191
|
-
console.log('Received packets on remote inbound-rtp belongs to this outbound-rtp', remoteInboundRtp?.
|
|
187
|
+
console.log('Received packets on remote inbound-rtp belongs to this outbound-rtp', remoteInboundRtp?.receivedPackets);
|
|
192
188
|
}
|
|
193
189
|
});
|
|
194
190
|
|
|
195
191
|
```
|
|
196
192
|
|
|
193
|
+
## Detectors and Alerts
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
## Alerts and Detectors
|
|
200
|
-
|
|
201
|
-
Alerts and detectors provide events of tracking and responding to anomalies or performance issues based on the polled stats. Detectors are components that continuously monitor for specific conditions in the polled stats, and set an alert if certain thresholds are hit. You can subscribe to alerts of an instantiated client-monitor-js and configure detectors via initial configurations.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
To configure the Congestion Detector according to your specific requirements, please refer to the [Configuration](#configuration) section for further guidance.
|
|
205
|
-
|
|
195
|
+
Detectors and alerts provide events of tracking and responding to anomalies or performance issues based on the polled stats. Detectors are components that continuously monitor for specific conditions in the polled stats, and set an alert if certain thresholds are hit. You can subscribe to alerts of an instantiated client-monitor-js and configure detectors via initial configurations.
|
|
206
196
|
|
|
207
197
|
List of built-in alerts:
|
|
208
|
-
* `stability-score-alert`: triggered whenever an outbound network is considered to be instable based on the calculated stability score
|
|
209
|
-
* `mean-opinion-score-alert`: triggered when a calculated MoS score for an inbound-rtp is lower than the configured threshold
|
|
210
198
|
* `audio-desync-alert`: triggered when for an audio track several acceleration and deceleration is detected in a short amount of time indicating that the controlling system tries compensate discrepancies.
|
|
211
199
|
* `cpu-performance-alert`: triggered whenever a browser detects quality limitation becasue of CPU, or the number of decoded frames per sec hit a certain threshold
|
|
212
200
|
|
|
201
|
+
### Audio Desync Detector
|
|
202
|
+
|
|
213
203
|
```javascript
|
|
214
204
|
import { createClientMonitor } from 'client-monitor-js';
|
|
215
205
|
|
|
@@ -218,24 +208,27 @@ const monitor = createClientMonitor({
|
|
|
218
208
|
collectingPeriodInMs: 2000,
|
|
219
209
|
});
|
|
220
210
|
|
|
221
|
-
monitor.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
211
|
+
monitor.detectors.addAudioDesyncDetector({
|
|
212
|
+
/**
|
|
213
|
+
* The fractional threshold used to determine if the audio desynchronization
|
|
214
|
+
* correction is considered significant or not.
|
|
215
|
+
* It represents the minimum required ratio of corrected samples to total samples.
|
|
216
|
+
* For example, a value of 0.1 means that if the corrected samples ratio
|
|
217
|
+
* exceeds 0.1, it will be considered a significant audio desynchronization issue.
|
|
218
|
+
*/
|
|
219
|
+
fractionalCorrectionAlertOnThreshold: 0.1;
|
|
220
|
+
/**
|
|
221
|
+
* The fractional threshold used to determine if the audio desynchronization
|
|
222
|
+
* correction is considered negligible and the alert should be turned off.
|
|
223
|
+
* It represents the maximum allowed ratio of corrected samples to total samples.
|
|
224
|
+
* For example, a value of 0.05 means that if the corrected samples ratio
|
|
225
|
+
* falls below 0.05, the audio desynchronization alert will be turned off.
|
|
226
|
+
*/
|
|
227
|
+
fractionalCorrectionAlertOffThreshold: 0.2;
|
|
228
|
+
});
|
|
236
229
|
|
|
237
|
-
|
|
238
|
-
if (
|
|
230
|
+
monitor.on('audio-desync-alert', (alertState) => {
|
|
231
|
+
if (alertState === 'on') {
|
|
239
232
|
console.log('Audio is desynced from video');
|
|
240
233
|
} else if (meanOpionionScoreAlert === 'off') {
|
|
241
234
|
console.log('Audio is synced back');
|
|
@@ -243,17 +236,37 @@ monitor.on('alerts-changed', (alerts) => {
|
|
|
243
236
|
});
|
|
244
237
|
```
|
|
245
238
|
|
|
239
|
+
### CPU Performance Detector
|
|
246
240
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
```javascript
|
|
242
|
+
monitor.detectors.addCpuPerformanceDetector({
|
|
243
|
+
/**
|
|
244
|
+
* The fractional threshold used to determine if the incoming frames
|
|
245
|
+
* dropped fraction is considered significant or not.
|
|
246
|
+
* It represents the maximum allowed ratio of dropped frames to received frames.
|
|
247
|
+
* For example, a value of 0.1 means that if the dropped frames fraction
|
|
248
|
+
* exceeds 0.1, it will be considered a significant issue.
|
|
249
|
+
*/
|
|
250
|
+
droppedIncomingFramesFractionAlertOn: 0.5;
|
|
251
|
+
/**
|
|
252
|
+
* The fractional threshold used to determine if the incoming frames
|
|
253
|
+
* dropped fraction is considered negligible and the alert should be turned off.
|
|
254
|
+
* It represents the maximum allowed ratio of dropped frames to received frames.
|
|
255
|
+
* For example, a value of 0.05 means that if the dropped frames fraction
|
|
256
|
+
* falls below 0.05, the CPU issue alert will be turned off.
|
|
257
|
+
*/
|
|
258
|
+
droppedIncomingFramesFractionAlertOff: 0.8;
|
|
259
|
+
})
|
|
254
260
|
|
|
255
|
-
For each inbound-rtp a MoS is calculated, which is a value between `0.0..5.0` indicate the quality of the rendered media.
|
|
256
261
|
|
|
262
|
+
monitor.on('cpu-performance-alert', alertState => {
|
|
263
|
+
if (alertState === 'on') {
|
|
264
|
+
console.log('CPU performance problem is detected');
|
|
265
|
+
} else if (meanOpionionScoreAlert === 'off') {
|
|
266
|
+
console.log('CPU performance problem is gone');
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
```
|
|
257
270
|
|
|
258
271
|
## Configurations
|
|
259
272
|
|
|
@@ -274,136 +287,12 @@ const config = {
|
|
|
274
287
|
samplingPeriodInMs: 10000,
|
|
275
288
|
|
|
276
289
|
/**
|
|
277
|
-
*
|
|
290
|
+
* This is the interval the monitor periodically checks
|
|
291
|
+
* if collecting or sampling action should be invoked or not.
|
|
278
292
|
*
|
|
279
|
-
* DEFAULT: undefined
|
|
280
|
-
*/
|
|
281
|
-
sendingPeriodInMs: 10000,
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* By enabling this option, the monitor automatically generates events
|
|
285
|
-
* when a peer connection added to the collector undergoes a change in connection state or when a track on it is added or removed.
|
|
286
|
-
*
|
|
287
|
-
* If this option is set to true, the samples created by the monitor will include the generated events. However, if
|
|
288
|
-
* no sample is created, events will accumulate indefinitely within the monitor. It is recommended to set this option to true
|
|
289
|
-
* if you want to create a sample with events.
|
|
290
|
-
*
|
|
291
|
-
* DEFAULT: false
|
|
293
|
+
* DEFAULT: if collecting or sampling period is set the default value is 1000, otherwise it's undefined
|
|
292
294
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Collector Component related configurations
|
|
297
|
-
*
|
|
298
|
-
* DEFAULT: configured by the monitor
|
|
299
|
-
*/
|
|
300
|
-
collectors: {
|
|
301
|
-
/**
|
|
302
|
-
* Sets the adapter adapt different browser type and version
|
|
303
|
-
* provided stats.
|
|
304
|
-
*
|
|
305
|
-
* DEFAULT: configured by the monitor
|
|
306
|
-
*/
|
|
307
|
-
adapter: {
|
|
308
|
-
/**
|
|
309
|
-
* the type of the browser, e.g.: chrome, firefox, safari
|
|
310
|
-
*
|
|
311
|
-
* DEFAULT: configured by the collector
|
|
312
|
-
*/
|
|
313
|
-
browserType: "chrome",
|
|
314
|
-
/**
|
|
315
|
-
* the version of the browser, e.g.: 97.xx.xxxxx
|
|
316
|
-
*
|
|
317
|
-
* DEFAULT: configured by the collector
|
|
318
|
-
*/
|
|
319
|
-
browserVersion: "97.1111.111",
|
|
320
|
-
},
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Configuration for the CpuIssueDetector function.
|
|
325
|
-
*
|
|
326
|
-
* Default configuration below
|
|
327
|
-
*/
|
|
328
|
-
cpuIssueDetector: {
|
|
329
|
-
/**
|
|
330
|
-
* Specifies whether the CPU issue detector is enabled or not.
|
|
331
|
-
*/
|
|
332
|
-
enabled: true;
|
|
333
|
-
/**
|
|
334
|
-
* The fractional threshold used to determine if the incoming frames
|
|
335
|
-
* dropped fraction is considered significant or not.
|
|
336
|
-
* It represents the maximum allowed ratio of dropped frames to received frames.
|
|
337
|
-
* For example, a value of 0.1 means that if the dropped frames fraction
|
|
338
|
-
* exceeds 0.1, it will be considered a significant issue.
|
|
339
|
-
*/
|
|
340
|
-
droppedIncomingFramesFractionAlertOn: 0.5;
|
|
341
|
-
/**
|
|
342
|
-
* The fractional threshold used to determine if the incoming frames
|
|
343
|
-
* dropped fraction is considered negligible and the alert should be turned off.
|
|
344
|
-
* It represents the maximum allowed ratio of dropped frames to received frames.
|
|
345
|
-
* For example, a value of 0.05 means that if the dropped frames fraction
|
|
346
|
-
* falls below 0.05, the CPU issue alert will be turned off.
|
|
347
|
-
*/
|
|
348
|
-
droppedIncomingFramesFractionAlertOff: 0.8;
|
|
349
|
-
},
|
|
350
|
-
/**
|
|
351
|
-
* Configuration for the AudioDesyncDetector function.
|
|
352
|
-
*
|
|
353
|
-
* Default configuration below
|
|
354
|
-
*/
|
|
355
|
-
audioDesyncDetector: {
|
|
356
|
-
/**
|
|
357
|
-
* Specifies whether the audio desynchronization detector is enabled or not.
|
|
358
|
-
*/
|
|
359
|
-
enabled: true;
|
|
360
|
-
/**
|
|
361
|
-
* The fractional threshold used to determine if the audio desynchronization
|
|
362
|
-
* correction is considered significant or not.
|
|
363
|
-
* It represents the minimum required ratio of corrected samples to total samples.
|
|
364
|
-
* For example, a value of 0.1 means that if the corrected samples ratio
|
|
365
|
-
* exceeds 0.1, it will be considered a significant audio desynchronization issue.
|
|
366
|
-
*/
|
|
367
|
-
fractionalCorrectionAlertOnThreshold: 0.1;
|
|
368
|
-
/**
|
|
369
|
-
* The fractional threshold used to determine if the audio desynchronization
|
|
370
|
-
* correction is considered negligible and the alert should be turned off.
|
|
371
|
-
* It represents the maximum allowed ratio of corrected samples to total samples.
|
|
372
|
-
* For example, a value of 0.05 means that if the corrected samples ratio
|
|
373
|
-
* falls below 0.05, the audio desynchronization alert will be turned off.
|
|
374
|
-
*/
|
|
375
|
-
fractionalCorrectionAlertOffThreshold: 0.2;
|
|
376
|
-
},
|
|
377
|
-
lowStabilityScoreDetector: {
|
|
378
|
-
/**
|
|
379
|
-
* Boolean indicating whether the detector is enabled or not
|
|
380
|
-
*/
|
|
381
|
-
enabled: true;
|
|
382
|
-
/**
|
|
383
|
-
* The threshold at which an alert is turned on
|
|
384
|
-
*/
|
|
385
|
-
alertOnThreshold: 0.8;
|
|
386
|
-
/**
|
|
387
|
-
* The threshold at which an alert is turned off
|
|
388
|
-
*/
|
|
389
|
-
alertOffThreshold: 0.9;
|
|
390
|
-
},
|
|
391
|
-
lowMosDetector: {
|
|
392
|
-
/**
|
|
393
|
-
* Specifies whether the Low Mean Opinion Score detector is enabled or not.
|
|
394
|
-
*/
|
|
395
|
-
enabled: true;
|
|
396
|
-
/**
|
|
397
|
-
* The threshold value for triggering a Low Mean Opinion Score alert.
|
|
398
|
-
* If the mean opinion score (MOS) falls below this value, an alert will be triggered.
|
|
399
|
-
*/
|
|
400
|
-
alertOnThreshold: 3.0;
|
|
401
|
-
/**
|
|
402
|
-
* The threshold value for turning off the Low Mean Opinion Score alert.
|
|
403
|
-
* If the mean opinion score (MOS) rises above this value, the alert will be turned off.
|
|
404
|
-
*/
|
|
405
|
-
alertOffThreshold: 4.0;
|
|
406
|
-
}
|
|
295
|
+
tickingTimeInMs: 10000,
|
|
407
296
|
};
|
|
408
297
|
```
|
|
409
298
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OperationSystem, Browser, Platform, Engine, MediaDevice } from './schema/Samples';
|
|
2
|
+
export type StoredMediaDevice = MediaDevice & {
|
|
3
|
+
sampled: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare class ClientMetaData {
|
|
6
|
+
readonly operationSystem: OperationSystem;
|
|
7
|
+
readonly browser: Browser;
|
|
8
|
+
readonly platform: Platform;
|
|
9
|
+
readonly engine: Engine;
|
|
10
|
+
private readonly _mediaDevices;
|
|
11
|
+
constructor();
|
|
12
|
+
set mediaDevices(values: MediaDevice[]);
|
|
13
|
+
get mediaDevices(): MediaDevice[];
|
|
14
|
+
/**
|
|
15
|
+
* Iterable iterator for the audio input devices obtained by the observer.
|
|
16
|
+
*/
|
|
17
|
+
audioInputs(): IterableIterator<StoredMediaDevice>;
|
|
18
|
+
/**
|
|
19
|
+
* Iterable iterator for the audio output devices obtained by the observer.
|
|
20
|
+
*/
|
|
21
|
+
audioOutputs(): IterableIterator<StoredMediaDevice>;
|
|
22
|
+
/**
|
|
23
|
+
* Iterable iterator for the video input devices obtained by the observer.
|
|
24
|
+
*/
|
|
25
|
+
videoInputs(): IterableIterator<StoredMediaDevice>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ClientMetaData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientMetaData.d.ts","sourceRoot":"","sources":["../src/ClientMetaData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA+B3F,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC1C,OAAO,EAAE,OAAO,CAAC;CACpB,CAAA;AAED,qBAAa,cAAc;IACvB,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyD;;IA8BvF,IAAW,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,EAe5C;IAED,IAAW,YAAY,IAAI,WAAW,EAAE,CAEvC;IAED;;OAEG;IACI,WAAW,IAAI,gBAAgB,CAAC,iBAAiB,CAAC;IAIzD;;OAEG;IACI,YAAY,IAAI,gBAAgB,CAAC,iBAAiB,CAAC;IAI1D;;OAEG;IACI,WAAW,IAAI,gBAAgB,CAAC,iBAAiB,CAAC;CAG5D"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ClientMetaData = void 0;
|
|
27
|
+
const Bowser = __importStar(require("bowser"));
|
|
28
|
+
const logger_1 = require("./utils/logger");
|
|
29
|
+
const IndexedMap_1 = require("./utils/IndexedMap");
|
|
30
|
+
// import * as proto from "./ProtobufSamples"
|
|
31
|
+
const logger = (0, logger_1.createLogger)("ClientDevices");
|
|
32
|
+
const UNKNOWN_OS = {
|
|
33
|
+
name: "Unkown",
|
|
34
|
+
version: undefined,
|
|
35
|
+
versionName: undefined,
|
|
36
|
+
};
|
|
37
|
+
const UNKNOWN_BROWSER = {
|
|
38
|
+
name: "Unknown",
|
|
39
|
+
version: undefined,
|
|
40
|
+
};
|
|
41
|
+
const UNKNOWN_PLATFORM = {
|
|
42
|
+
type: "Unknown",
|
|
43
|
+
vendor: undefined,
|
|
44
|
+
model: undefined,
|
|
45
|
+
};
|
|
46
|
+
const UNKNOWN_ENGINE = {
|
|
47
|
+
name: "Unknown",
|
|
48
|
+
version: undefined,
|
|
49
|
+
};
|
|
50
|
+
const MEDIA_DEVICE_KIND = 'mediaDeviceKind';
|
|
51
|
+
class ClientMetaData {
|
|
52
|
+
constructor() {
|
|
53
|
+
try {
|
|
54
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
55
|
+
let outerNavigator = undefined;
|
|
56
|
+
if (navigator !== undefined)
|
|
57
|
+
outerNavigator = navigator;
|
|
58
|
+
else if (window !== undefined && window.navigator !== undefined)
|
|
59
|
+
outerNavigator = window.navigator;
|
|
60
|
+
else
|
|
61
|
+
throw new Error(`navigator is not available`);
|
|
62
|
+
const parsedResult = Bowser.parse(outerNavigator.userAgent);
|
|
63
|
+
this.browser = parsedResult.browser;
|
|
64
|
+
this.engine = parsedResult.engine;
|
|
65
|
+
this.operationSystem = parsedResult.os;
|
|
66
|
+
this.platform = parsedResult.platform;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
logger.warn(`Cannot collect media devices and navigator data, because an error occurred`, err);
|
|
70
|
+
this.operationSystem = UNKNOWN_OS;
|
|
71
|
+
this.browser = UNKNOWN_BROWSER;
|
|
72
|
+
this.platform = UNKNOWN_PLATFORM;
|
|
73
|
+
this.engine = UNKNOWN_ENGINE;
|
|
74
|
+
}
|
|
75
|
+
this._mediaDevices = new IndexedMap_1.IndexedMap()
|
|
76
|
+
.addIndex(MEDIA_DEVICE_KIND, (device) => device.kind);
|
|
77
|
+
}
|
|
78
|
+
set mediaDevices(values) {
|
|
79
|
+
const visited = new Set();
|
|
80
|
+
for (const mediaDevice of values) {
|
|
81
|
+
if (!mediaDevice.id)
|
|
82
|
+
continue;
|
|
83
|
+
visited.add(mediaDevice.id);
|
|
84
|
+
if (this._mediaDevices.has(mediaDevice.id))
|
|
85
|
+
continue;
|
|
86
|
+
this._mediaDevices.set(mediaDevice.id, {
|
|
87
|
+
...mediaDevice,
|
|
88
|
+
sampled: false,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
for (const [id] of this._mediaDevices.entries()) {
|
|
92
|
+
if (visited.has(id))
|
|
93
|
+
continue;
|
|
94
|
+
this._mediaDevices.delete(id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
get mediaDevices() {
|
|
98
|
+
return Array.from(this._mediaDevices.values());
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Iterable iterator for the audio input devices obtained by the observer.
|
|
102
|
+
*/
|
|
103
|
+
audioInputs() {
|
|
104
|
+
return this._mediaDevices.values(MEDIA_DEVICE_KIND, "audioinput");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Iterable iterator for the audio output devices obtained by the observer.
|
|
108
|
+
*/
|
|
109
|
+
audioOutputs() {
|
|
110
|
+
return this._mediaDevices.values(MEDIA_DEVICE_KIND, "audiooutput");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Iterable iterator for the video input devices obtained by the observer.
|
|
114
|
+
*/
|
|
115
|
+
videoInputs() {
|
|
116
|
+
return this._mediaDevices.values(MEDIA_DEVICE_KIND, "videoinput");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.ClientMetaData = ClientMetaData;
|