@observertc/observer-js 0.42.9 → 1.0.1-57a1811.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/.prettierrc +6 -6
- package/README.md +0 -104
- package/lib/ObservedCall.d.ts +38 -41
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +97 -109
- package/lib/ObservedCertificate.d.ts +19 -0
- package/lib/ObservedCertificate.d.ts.map +1 -0
- package/lib/ObservedCertificate.js +38 -0
- package/lib/ObservedClient.d.ts +49 -127
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +201 -750
- package/lib/ObservedCodec.d.ts +22 -0
- package/lib/ObservedCodec.d.ts.map +1 -0
- package/lib/ObservedCodec.js +45 -0
- package/lib/ObservedDataChannel.d.ts +23 -69
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +67 -109
- package/lib/ObservedIceCandidate.d.ts +29 -0
- package/lib/ObservedIceCandidate.d.ts.map +1 -0
- package/lib/ObservedIceCandidate.js +59 -0
- package/lib/ObservedIceCandidatePair.d.ts +44 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/ObservedIceCandidatePair.js +111 -0
- package/lib/ObservedIceTransport.d.ts +32 -0
- package/lib/ObservedIceTransport.d.ts.map +1 -0
- package/lib/ObservedIceTransport.js +65 -0
- package/lib/ObservedInboundRtp.d.ts +92 -0
- package/lib/ObservedInboundRtp.d.ts.map +1 -0
- package/lib/ObservedInboundRtp.js +193 -0
- package/lib/ObservedInboundTrack.d.ts +29 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +57 -0
- package/lib/ObservedMediaPlayout.d.ts +22 -0
- package/lib/ObservedMediaPlayout.d.ts.map +1 -0
- package/lib/ObservedMediaPlayout.js +42 -0
- package/lib/ObservedMediaSource.d.ts +28 -0
- package/lib/ObservedMediaSource.d.ts.map +1 -0
- package/lib/ObservedMediaSource.js +55 -0
- package/lib/ObservedOutboundRtp.d.ts +62 -0
- package/lib/ObservedOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedOutboundRtp.js +144 -0
- package/lib/ObservedOutboundTrack.d.ts +29 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +57 -0
- package/lib/ObservedPeerConnection.d.ts +128 -78
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +624 -357
- package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
- package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
- package/lib/ObservedPeerConnectionTransport.js +34 -0
- package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteInboundRtp.js +60 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteOutboundRtp.js +60 -0
- package/lib/ObservedTURN.d.ts +31 -0
- package/lib/ObservedTURN.d.ts.map +1 -0
- package/lib/ObservedTURN.js +58 -0
- package/lib/ObservedTurnServer.d.ts +25 -0
- package/lib/ObservedTurnServer.d.ts.map +1 -0
- package/lib/ObservedTurnServer.js +59 -0
- package/lib/Observer.d.ts +31 -51
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +75 -229
- package/lib/common/Middleware.d.ts +10 -1
- package/lib/common/Middleware.d.ts.map +1 -1
- package/lib/common/Middleware.js +55 -36
- package/lib/common/logger.d.ts +8 -4
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +44 -68
- package/lib/common/types.d.ts +0 -21
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +13 -1
- package/lib/detectors/Detector.d.ts +5 -0
- package/lib/detectors/Detector.d.ts.map +1 -0
- package/lib/detectors/Detector.js +3 -0
- package/lib/detectors/Detectors.d.ts +11 -0
- package/lib/detectors/Detectors.d.ts.map +1 -0
- package/lib/detectors/Detectors.js +34 -0
- package/lib/index.d.ts +24 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -41
- package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
- package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
- package/lib/monitors/TurnUsageMonitor.js +145 -120
- package/lib/schema/ClientEventTypes.d.ts +33 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +38 -0
- package/lib/schema/ClientMetaTypes.d.ts +34 -0
- package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
- package/lib/schema/ClientMetaTypes.js +16 -0
- package/lib/schema/ClientSample.d.ts +1333 -0
- package/lib/schema/ClientSample.d.ts.map +1 -0
- package/lib/schema/ClientSample.js +4 -0
- package/lib/scores/CalculatedScore.d.ts +6 -0
- package/lib/scores/CalculatedScore.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.js +21 -0
- package/lib/scores/ScoreCalculator.d.ts +4 -0
- package/lib/scores/ScoreCalculator.d.ts.map +1 -0
- package/lib/scores/ScoreCalculator.js +2 -0
- package/lib/utils/CallUpdater.d.ts +5 -0
- package/lib/utils/CallUpdater.d.ts.map +1 -0
- package/lib/utils/CallUpdater.js +2 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts +16 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/OnAllClientCallUpdater.js +58 -0
- package/lib/utils/RemoteTrackResolver.d.ts +7 -0
- package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/RemoteTrackResolver.js +2 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts +14 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/onAnyClientCallUpdater.js +51 -0
- package/package.json +4 -4
- package/src/ObservedCall.ts +116 -166
- package/src/ObservedCertificate.ts +43 -0
- package/src/ObservedClient.ts +213 -1060
- package/src/ObservedCodec.ts +49 -0
- package/src/ObservedDataChannel.ts +68 -181
- package/src/ObservedIceCandidate.ts +64 -0
- package/src/ObservedIceCandidatePair.ts +118 -0
- package/src/ObservedIceTransport.ts +70 -0
- package/src/ObservedInboundRtp.ts +205 -0
- package/src/ObservedInboundTrack.ts +70 -0
- package/src/ObservedMediaPlayout.ts +49 -0
- package/src/ObservedMediaSource.ts +60 -0
- package/src/ObservedOutboundRtp.ts +156 -0
- package/src/ObservedOutboundTrack.ts +69 -0
- package/src/ObservedPeerConnection.ts +827 -405
- package/src/ObservedPeerConnectionTransport.ts +38 -0
- package/src/ObservedRemoteInboundRtp.ts +64 -0
- package/src/ObservedRemoteOutboundRtp.ts +65 -0
- package/src/ObservedTURN.ts +86 -0
- package/src/ObservedTurnServer.ts +72 -0
- package/src/Observer.ts +91 -302
- package/src/common/Middleware.ts +70 -42
- package/src/common/logger.ts +60 -69
- package/src/common/types.ts +0 -42
- package/src/common/utils.ts +12 -0
- package/src/detectors/Detector.ts +6 -0
- package/src/detectors/Detectors.ts +38 -0
- package/src/index.ts +24 -90
- package/src/monitors/TurnUsageMonitor.ts +164 -164
- package/src/schema/ClientEventTypes.ts +36 -0
- package/src/schema/ClientMetaTypes.ts +41 -0
- package/src/schema/ClientSample.ts +1682 -0
- package/src/scores/CalculatedScore.ts +6 -0
- package/src/scores/DefaultCallScoreCalculator.ts +23 -0
- package/src/scores/ScoreCalculator.ts +3 -0
- package/src/utils/CallUpdater.ts +5 -0
- package/src/utils/OnAllClientCallUpdater.ts +68 -0
- package/src/utils/RemoteTrackResolver.ts +12 -0
- package/src/utils/onAnyClientCallUpdater.ts +59 -0
- package/tsconfig.json +3 -3
- package/lib/ObservedICE.d.ts +0 -64
- package/lib/ObservedICE.d.ts.map +0 -1
- package/lib/ObservedICE.js +0 -141
- package/lib/ObservedInboundAudioTrack.d.ts +0 -96
- package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedInboundAudioTrack.js +0 -217
- package/lib/ObservedInboundVideoTrack.d.ts +0 -101
- package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedInboundVideoTrack.js +0 -232
- package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
- package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundAudioTrack.js +0 -186
- package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
- package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundVideoTrack.js +0 -193
- package/lib/ObservedSfu.d.ts +0 -59
- package/lib/ObservedSfu.d.ts.map +0 -1
- package/lib/ObservedSfu.js +0 -157
- package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuInboundRtpPad.js +0 -71
- package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuOutboundRtpPad.js +0 -72
- package/lib/ObservedSfuSctpChannel.d.ts +0 -42
- package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/ObservedSfuSctpChannel.js +0 -57
- package/lib/ObservedSfuTransport.d.ts +0 -58
- package/lib/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/ObservedSfuTransport.js +0 -120
- package/lib/RemoteTrackAssigner.d.ts +0 -14
- package/lib/RemoteTrackAssigner.d.ts.map +0 -1
- package/lib/RemoteTrackAssigner.js +0 -52
- package/lib/ReportsCollector.d.ts +0 -109
- package/lib/ReportsCollector.d.ts.map +0 -1
- package/lib/ReportsCollector.js +0 -207
- package/lib/common/CalculatedScore.d.ts +0 -80
- package/lib/common/CalculatedScore.d.ts.map +0 -1
- package/lib/common/CalculatedScore.js +0 -162
- package/lib/common/CallEventType.d.ts +0 -63
- package/lib/common/CallEventType.d.ts.map +0 -1
- package/lib/common/CallEventType.js +0 -39
- package/lib/common/CallMetaReports.d.ts +0 -42
- package/lib/common/CallMetaReports.d.ts.map +0 -1
- package/lib/common/CallMetaReports.js +0 -36
- package/lib/common/QualityScoreUtils.d.ts +0 -1
- package/lib/common/QualityScoreUtils.d.ts.map +0 -1
- package/lib/common/QualityScoreUtils.js +0 -1
- package/lib/common/TypedEventEmitter.d.ts +0 -22
- package/lib/common/TypedEventEmitter.d.ts.map +0 -1
- package/lib/common/TypedEventEmitter.js +0 -11
- package/lib/common/callEventReports.d.ts +0 -10
- package/lib/common/callEventReports.d.ts.map +0 -1
- package/lib/common/callEventReports.js +0 -112
- package/lib/monitors/CallSummary.d.ts +0 -37
- package/lib/monitors/CallSummary.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
- package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.js +0 -152
- package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
- package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
- package/lib/monitors/ClientIssueMonitor.js +0 -49
- package/lib/monitors/SfuServerMonitor.d.ts +0 -79
- package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
- package/lib/monitors/SfuServerMonitor.js +0 -198
- package/src/ObservedICE.ts +0 -237
- package/src/ObservedInboundAudioTrack.ts +0 -344
- package/src/ObservedInboundVideoTrack.ts +0 -361
- package/src/ObservedOutboundAudioTrack.ts +0 -307
- package/src/ObservedOutboundVideoTrack.ts +0 -319
- package/src/ObservedSfu.ts +0 -231
- package/src/ObservedSfuInboundRtpPad.ts +0 -106
- package/src/ObservedSfuOutboundRtpPad.ts +0 -107
- package/src/ObservedSfuSctpChannel.ts +0 -103
- package/src/ObservedSfuTransport.ts +0 -185
- package/src/RemoteTrackAssigner.ts +0 -68
- package/src/ReportsCollector.ts +0 -336
- package/src/common/CalculatedScore.ts +0 -188
- package/src/common/CallEventType.ts +0 -69
- package/src/common/CallMetaReports.ts +0 -82
- package/src/common/QualityScoreUtils.ts +0 -0
- package/src/common/TypedEventEmitter.ts +0 -32
- package/src/common/callEventReports.ts +0 -178
- package/src/monitors/CallSummary.ts +0 -38
- package/src/monitors/CallSummaryMonitor.ts +0 -192
- package/src/monitors/ClientIssueMonitor.ts +0 -88
- package/src/monitors/SfuServerMonitor.ts +0 -285
- /package/lib/{monitors/CallSummary.js → scores/CalculatedScore.js} +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CallSummaryMonitor = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class CallSummaryMonitor extends events_1.EventEmitter {
|
|
6
|
-
constructor(config = {}) {
|
|
7
|
-
super();
|
|
8
|
-
this.config = config;
|
|
9
|
-
this._summaries = new Map();
|
|
10
|
-
this._closed = false;
|
|
11
|
-
this.setMaxListeners(Infinity);
|
|
12
|
-
}
|
|
13
|
-
addCall(call) {
|
|
14
|
-
if (this.closed)
|
|
15
|
-
return;
|
|
16
|
-
let callSummary = this._summaries.get(call.callId);
|
|
17
|
-
if (!callSummary) {
|
|
18
|
-
callSummary = {
|
|
19
|
-
callId: call.callId,
|
|
20
|
-
roomId: call.roomId,
|
|
21
|
-
serviceId: call.serviceId,
|
|
22
|
-
clients: [],
|
|
23
|
-
durationInMs: 0,
|
|
24
|
-
maxNumberOfParticipants: 0,
|
|
25
|
-
numberOfIssues: 0,
|
|
26
|
-
started: call.created,
|
|
27
|
-
};
|
|
28
|
-
this._summaries.set(call.callId, callSummary);
|
|
29
|
-
}
|
|
30
|
-
const constCallSummary = callSummary;
|
|
31
|
-
const onNewClient = (client) => {
|
|
32
|
-
constCallSummary.maxNumberOfParticipants = Math.max(constCallSummary.maxNumberOfParticipants, call.clients.size);
|
|
33
|
-
this._addClient(constCallSummary, client);
|
|
34
|
-
};
|
|
35
|
-
call.once('close', () => {
|
|
36
|
-
call.off('newclient', onNewClient);
|
|
37
|
-
});
|
|
38
|
-
call.on('newclient', onNewClient);
|
|
39
|
-
}
|
|
40
|
-
_addClient(callSummary, client) {
|
|
41
|
-
if (this.closed)
|
|
42
|
-
return;
|
|
43
|
-
const clientSummary = {
|
|
44
|
-
clientId: client.clientId,
|
|
45
|
-
mediaUnitId: client.mediaUnitId,
|
|
46
|
-
durationInMs: 0,
|
|
47
|
-
totalInboundAudioBytes: 0,
|
|
48
|
-
totalInboundVideoBytes: 0,
|
|
49
|
-
totalOutboundAudioBytes: 0,
|
|
50
|
-
totalOutboundVideoBytes: 0,
|
|
51
|
-
totalDataChannelBytesSent: 0,
|
|
52
|
-
totalDataChannelBytesReceived: 0,
|
|
53
|
-
ewmaRttInMs: 0,
|
|
54
|
-
joined: client.created,
|
|
55
|
-
userId: client.userId,
|
|
56
|
-
usedTurn: false,
|
|
57
|
-
issues: [],
|
|
58
|
-
};
|
|
59
|
-
callSummary.clients.push(clientSummary);
|
|
60
|
-
const updateClient = () => {
|
|
61
|
-
if (client.avgRttInMs) {
|
|
62
|
-
clientSummary.ewmaRttInMs = (clientSummary.ewmaRttInMs * 0.9) + (client.avgRttInMs * 0.1);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const onUsingTurn = (usingTurn) => {
|
|
66
|
-
clientSummary.usedTurn || (clientSummary.usedTurn = usingTurn);
|
|
67
|
-
};
|
|
68
|
-
const onUserMediaError = (error) => {
|
|
69
|
-
if (!this.config.detectUserMediaIssues)
|
|
70
|
-
return;
|
|
71
|
-
client.addIssue({
|
|
72
|
-
severity: 'critical',
|
|
73
|
-
timestamp: Date.now(),
|
|
74
|
-
description: error,
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
const onNewPeerConnection = (peerConnection) => this._addPeerConnection(clientSummary, peerConnection);
|
|
78
|
-
client.on('update', updateClient);
|
|
79
|
-
client.on('usingturn', onUsingTurn);
|
|
80
|
-
client.on('usermediaerror', onUserMediaError);
|
|
81
|
-
client.on('newpeerconnection', onNewPeerConnection);
|
|
82
|
-
client.once('close', () => {
|
|
83
|
-
const now = Date.now();
|
|
84
|
-
clientSummary.totalInboundAudioBytes = client.totalReceivedAudioBytes;
|
|
85
|
-
clientSummary.totalInboundVideoBytes = client.totalReceivedVideoBytes;
|
|
86
|
-
clientSummary.totalOutboundAudioBytes = client.totalSentAudioBytes;
|
|
87
|
-
clientSummary.totalOutboundVideoBytes = client.totalSentVideoBytes;
|
|
88
|
-
clientSummary.totalDataChannelBytesSent = client.totalDataChannelBytesSent;
|
|
89
|
-
clientSummary.totalDataChannelBytesReceived = client.totalDataChannelBytesReceived;
|
|
90
|
-
clientSummary.durationInMs = now - client.created;
|
|
91
|
-
clientSummary.left = now;
|
|
92
|
-
// client does not store issues after update emitted
|
|
93
|
-
// clientSummary.issues.push(...client.issues);
|
|
94
|
-
client.off('update', updateClient);
|
|
95
|
-
client.off('usingturn', onUsingTurn);
|
|
96
|
-
client.off('usermediaerror', onUserMediaError);
|
|
97
|
-
client.off('newpeerconnection', onNewPeerConnection);
|
|
98
|
-
callSummary.durationInMs += clientSummary.durationInMs;
|
|
99
|
-
callSummary.numberOfIssues += clientSummary.issues.length;
|
|
100
|
-
callSummary.highestSeverity = clientSummary.issues.reduce((highest, issue) => {
|
|
101
|
-
if (issue.severity === 'critical')
|
|
102
|
-
return 'critical';
|
|
103
|
-
if (issue.severity === 'major' && highest !== 'critical')
|
|
104
|
-
return 'major';
|
|
105
|
-
if (issue.severity === 'minor' && highest !== 'critical' && highest !== 'major')
|
|
106
|
-
return 'minor';
|
|
107
|
-
return highest;
|
|
108
|
-
}, callSummary.highestSeverity);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
_addPeerConnection(clientSummary, peerConnection) {
|
|
112
|
-
const onOutboundVideoTrack = (track) => this._addOutboundVideoTrack(clientSummary, track);
|
|
113
|
-
peerConnection.on('newoutboundvideotrack', onOutboundVideoTrack);
|
|
114
|
-
peerConnection.once('close', () => {
|
|
115
|
-
peerConnection.off('newoutboundvideotrack', onOutboundVideoTrack);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
_addOutboundVideoTrack(clientSummary, track) {
|
|
119
|
-
const onQualityLimitationChanged = (reason) => {
|
|
120
|
-
if (!this.config.detectMediaTrackQualityLimitationIssues)
|
|
121
|
-
return;
|
|
122
|
-
track.peerConnection.client.addIssue({
|
|
123
|
-
severity: 'minor',
|
|
124
|
-
timestamp: Date.now(),
|
|
125
|
-
description: reason,
|
|
126
|
-
peerConnectionId: track.peerConnectionId,
|
|
127
|
-
trackId: track.trackId,
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
track.once('close', () => {
|
|
131
|
-
track.off('qualitylimitationchanged', onQualityLimitationChanged);
|
|
132
|
-
});
|
|
133
|
-
track.on('qualitylimitationchanged', onQualityLimitationChanged);
|
|
134
|
-
}
|
|
135
|
-
takeSummary(callId) {
|
|
136
|
-
if (this.closed)
|
|
137
|
-
return;
|
|
138
|
-
const summary = this._summaries.get(callId);
|
|
139
|
-
this._summaries.delete(callId);
|
|
140
|
-
return summary;
|
|
141
|
-
}
|
|
142
|
-
get closed() {
|
|
143
|
-
return this._closed;
|
|
144
|
-
}
|
|
145
|
-
close() {
|
|
146
|
-
if (this._closed)
|
|
147
|
-
return;
|
|
148
|
-
this._closed = true;
|
|
149
|
-
this.emit('close');
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.CallSummaryMonitor = CallSummaryMonitor;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import { ObservedCall } from '../ObservedCall';
|
|
4
|
-
import { ClientIssue } from './CallSummary';
|
|
5
|
-
export type ClientIssueMonitorEmittedIssueEvent = ClientIssue & {
|
|
6
|
-
clientId: string;
|
|
7
|
-
callId: string;
|
|
8
|
-
};
|
|
9
|
-
export type ClientIssueMonitorEvents = {
|
|
10
|
-
close: [];
|
|
11
|
-
issue: [ClientIssueMonitorEmittedIssueEvent];
|
|
12
|
-
major: [ClientIssueMonitorEmittedIssueEvent];
|
|
13
|
-
minor: [ClientIssueMonitorEmittedIssueEvent];
|
|
14
|
-
critical: [ClientIssueMonitorEmittedIssueEvent];
|
|
15
|
-
};
|
|
16
|
-
export type ClientIssueMonitorConfig = {};
|
|
17
|
-
export declare interface ClientIssueMonitor {
|
|
18
|
-
on<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
19
|
-
off<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
20
|
-
once<U extends keyof ClientIssueMonitorEvents>(event: U, listener: (...args: ClientIssueMonitorEvents[U]) => void): this;
|
|
21
|
-
emit<U extends keyof ClientIssueMonitorEvents>(event: U, ...args: ClientIssueMonitorEvents[U]): boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare class ClientIssueMonitor extends EventEmitter {
|
|
24
|
-
readonly config: ClientIssueMonitorConfig;
|
|
25
|
-
private _closed;
|
|
26
|
-
constructor(config?: ClientIssueMonitorConfig);
|
|
27
|
-
addCall(call: ObservedCall): void;
|
|
28
|
-
private _addClient;
|
|
29
|
-
get closed(): boolean;
|
|
30
|
-
close(): void;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ClientIssueMonitor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientIssueMonitor.d.ts","sourceRoot":"","sources":["../../src/monitors/ClientIssueMonitor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MA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wB;IAFjD,OAAO,CAAC,OAAO,CAAS;gBAEP,MAAM,GAAE,wBAA6B;IAM/C,OAAO,CAAC,IAAI,EAAE,YAAY;IAajC,OAAO,CAAC,UAAU;IAyBlB,IAAW,MAAM,YAEhB;IAEM,KAAK;CAMZ"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientIssueMonitor = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class ClientIssueMonitor extends events_1.EventEmitter {
|
|
6
|
-
constructor(config = {}) {
|
|
7
|
-
super();
|
|
8
|
-
this.config = config;
|
|
9
|
-
this._closed = false;
|
|
10
|
-
this.setMaxListeners(Infinity);
|
|
11
|
-
}
|
|
12
|
-
addCall(call) {
|
|
13
|
-
if (this.closed)
|
|
14
|
-
return;
|
|
15
|
-
const onNewClient = (client) => {
|
|
16
|
-
this._addClient(call, client);
|
|
17
|
-
};
|
|
18
|
-
call.once('close', () => {
|
|
19
|
-
call.off('newclient', onNewClient);
|
|
20
|
-
});
|
|
21
|
-
call.on('newclient', onNewClient);
|
|
22
|
-
}
|
|
23
|
-
_addClient(call, client) {
|
|
24
|
-
if (this.closed)
|
|
25
|
-
return;
|
|
26
|
-
const { callId } = call;
|
|
27
|
-
const { clientId } = client;
|
|
28
|
-
const onIssue = (issue) => {
|
|
29
|
-
const event = Object.assign(Object.assign({}, issue), { clientId,
|
|
30
|
-
callId });
|
|
31
|
-
this.emit(issue.severity, event);
|
|
32
|
-
this.emit('issue', event);
|
|
33
|
-
};
|
|
34
|
-
client.once('close', () => {
|
|
35
|
-
client.off('issue', onIssue);
|
|
36
|
-
});
|
|
37
|
-
client.on('issue', onIssue);
|
|
38
|
-
}
|
|
39
|
-
get closed() {
|
|
40
|
-
return this._closed;
|
|
41
|
-
}
|
|
42
|
-
close() {
|
|
43
|
-
if (this._closed)
|
|
44
|
-
return;
|
|
45
|
-
this._closed = true;
|
|
46
|
-
this.emit('close');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.ClientIssueMonitor = ClientIssueMonitor;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import { ObservedPeerConnection } from '../ObservedPeerConnection';
|
|
4
|
-
export type SfuServerMonitorMetricsRecord = {
|
|
5
|
-
sfuId: string;
|
|
6
|
-
receivedPacketsPerSecond: number;
|
|
7
|
-
sentPacketsPerSecond: number;
|
|
8
|
-
receivingAudioBitrate: number;
|
|
9
|
-
receivingVideoBitrate: number;
|
|
10
|
-
sendingAudioBitrate: number;
|
|
11
|
-
sendingVideoBitrate: number;
|
|
12
|
-
numberOfPeerConnectionsRttLt50: number;
|
|
13
|
-
numberOfPeerConnectionsRttLt150: number;
|
|
14
|
-
numberOfPeerConnectionsRttLt300: number;
|
|
15
|
-
numberOfPeerConnectionsRttOver300: number;
|
|
16
|
-
numberOfPeerConnections: number;
|
|
17
|
-
};
|
|
18
|
-
export type SfuServerMonitorConfig = {
|
|
19
|
-
tooHighRttAlertSettings: {
|
|
20
|
-
/**
|
|
21
|
-
* The threshold for the RTT that will trigger the alert
|
|
22
|
-
*/
|
|
23
|
-
threshold: 'rtt-gt-300' | 'rtt-gt-150' | 'rtt-gt-50';
|
|
24
|
-
/**
|
|
25
|
-
* The percentage of peer connections that need to be above the threshold to trigger the alert
|
|
26
|
-
*/
|
|
27
|
-
percentageOfPeerConnectionsHighWatermark: number;
|
|
28
|
-
/**
|
|
29
|
-
* The percentage of peer connections that need to be above the threshold to clear the alert
|
|
30
|
-
*/
|
|
31
|
-
percentageOfPeerConnectionsLowWatermark: number;
|
|
32
|
-
/**
|
|
33
|
-
* The minimum number of clients that need to be connected to trigger the alert
|
|
34
|
-
*/
|
|
35
|
-
minNumberOfPeerConnections: number;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export type SfuServerMonitorEvents = {
|
|
39
|
-
'metrics': [SfuServerMonitorMetricsRecord];
|
|
40
|
-
'high-rtt-started': [
|
|
41
|
-
{
|
|
42
|
-
sfuId: string;
|
|
43
|
-
threshold: SfuServerMonitorConfig['tooHighRttAlertSettings']['threshold'];
|
|
44
|
-
percentageOfPeerConnections: number;
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
'high-rtt-cleared': [
|
|
48
|
-
{
|
|
49
|
-
sfuId: string;
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
'too-many-clients': [{
|
|
53
|
-
ip: string;
|
|
54
|
-
numberOfClients: number;
|
|
55
|
-
}];
|
|
56
|
-
'close': [];
|
|
57
|
-
};
|
|
58
|
-
export declare interface SfuServerMonitor {
|
|
59
|
-
on<U extends keyof SfuServerMonitorEvents>(event: U, listener: (...args: SfuServerMonitorEvents[U]) => void): this;
|
|
60
|
-
off<U extends keyof SfuServerMonitorEvents>(event: U, listener: (...args: SfuServerMonitorEvents[U]) => void): this;
|
|
61
|
-
once<U extends keyof SfuServerMonitorEvents>(event: U, listener: (...args: SfuServerMonitorEvents[U]) => void): this;
|
|
62
|
-
emit<U extends keyof SfuServerMonitorEvents>(event: U, ...args: SfuServerMonitorEvents[U]): boolean;
|
|
63
|
-
}
|
|
64
|
-
export declare class SfuServerMonitor extends EventEmitter {
|
|
65
|
-
readonly config: SfuServerMonitorConfig;
|
|
66
|
-
private _closed;
|
|
67
|
-
private readonly _peerConnections;
|
|
68
|
-
private readonly _metrics;
|
|
69
|
-
private readonly _rttAlertsOn;
|
|
70
|
-
constructor(config: SfuServerMonitorConfig);
|
|
71
|
-
get stats(): SfuServerMonitorMetricsRecord[];
|
|
72
|
-
get closed(): boolean;
|
|
73
|
-
close(): void;
|
|
74
|
-
addPeerConnection(peerConnection: ObservedPeerConnection): void;
|
|
75
|
-
private _checkHighRttForClients;
|
|
76
|
-
private _increase;
|
|
77
|
-
private _subtract;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL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C,cAAc,EAAE,sBAAsB;IA4E/D,OAAO,CAAC,uBAAuB;IA8D/B,OAAO,CAAC,SAAS;IAqBjB,OAAO,CAAC,SAAS;CAqBjB"}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SfuServerMonitor = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class SfuServerMonitor extends events_1.EventEmitter {
|
|
6
|
-
constructor(config) {
|
|
7
|
-
super();
|
|
8
|
-
this.config = config;
|
|
9
|
-
this._closed = false;
|
|
10
|
-
this._peerConnections = new Map();
|
|
11
|
-
this._metrics = new Map();
|
|
12
|
-
this._rttAlertsOn = new Set();
|
|
13
|
-
}
|
|
14
|
-
get stats() {
|
|
15
|
-
return Array.from(this._metrics.values());
|
|
16
|
-
}
|
|
17
|
-
get closed() {
|
|
18
|
-
return this._closed;
|
|
19
|
-
}
|
|
20
|
-
close() {
|
|
21
|
-
if (this.closed)
|
|
22
|
-
return;
|
|
23
|
-
this._closed = true;
|
|
24
|
-
this._peerConnections.clear();
|
|
25
|
-
this._metrics.clear();
|
|
26
|
-
this._rttAlertsOn.clear();
|
|
27
|
-
this.emit('close');
|
|
28
|
-
}
|
|
29
|
-
addPeerConnection(peerConnection) {
|
|
30
|
-
if (this.closed)
|
|
31
|
-
return;
|
|
32
|
-
let registered = false;
|
|
33
|
-
const onUpdate = () => {
|
|
34
|
-
const sfuId = peerConnection.client.sfuId;
|
|
35
|
-
const peerConnectionRecord = this._peerConnections.get(peerConnection.peerConnectionId);
|
|
36
|
-
if (!sfuId)
|
|
37
|
-
return;
|
|
38
|
-
let metrics = this._metrics.get(sfuId);
|
|
39
|
-
if (!metrics) {
|
|
40
|
-
metrics = {
|
|
41
|
-
sfuId,
|
|
42
|
-
receivedPacketsPerSecond: 0,
|
|
43
|
-
sentPacketsPerSecond: 0,
|
|
44
|
-
receivingAudioBitrate: 0,
|
|
45
|
-
receivingVideoBitrate: 0,
|
|
46
|
-
sendingAudioBitrate: 0,
|
|
47
|
-
sendingVideoBitrate: 0,
|
|
48
|
-
numberOfPeerConnectionsRttLt150: 0,
|
|
49
|
-
numberOfPeerConnectionsRttLt300: 0,
|
|
50
|
-
numberOfPeerConnectionsRttLt50: 0,
|
|
51
|
-
numberOfPeerConnectionsRttOver300: 0,
|
|
52
|
-
numberOfPeerConnections: 0,
|
|
53
|
-
};
|
|
54
|
-
this._metrics.set(sfuId, metrics);
|
|
55
|
-
}
|
|
56
|
-
if (!registered) {
|
|
57
|
-
registered = true;
|
|
58
|
-
++metrics.numberOfPeerConnections;
|
|
59
|
-
}
|
|
60
|
-
if (peerConnectionRecord) {
|
|
61
|
-
this._subtract(metrics, peerConnectionRecord);
|
|
62
|
-
}
|
|
63
|
-
this._increase(metrics, peerConnection);
|
|
64
|
-
this._peerConnections.set(peerConnection.peerConnectionId, {
|
|
65
|
-
lastSendingAudioBitrate: peerConnection.sendingAudioBitrate,
|
|
66
|
-
lastSendingVideoBitrate: peerConnection.sendingVideoBitrate,
|
|
67
|
-
lastReceivingAudioBitrate: peerConnection.receivingAudioBitrate,
|
|
68
|
-
lastReceivingVideoBitrate: peerConnection.receivingVideoBitrate,
|
|
69
|
-
lastAvgRttInMs: peerConnection.avgRttInMs,
|
|
70
|
-
lastReceivingPacketsPerSecond: peerConnection.receivingPacketsPerSecond,
|
|
71
|
-
lastSendingPacketsPerSecond: peerConnection.sendingPacketsPerSecond,
|
|
72
|
-
});
|
|
73
|
-
this._checkHighRttForClients(metrics);
|
|
74
|
-
};
|
|
75
|
-
peerConnection.once('close', () => {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
const address = (_b = (_a = peerConnection.ICE.selectedRemoteCandidate) === null || _a === void 0 ? void 0 : _a.address) !== null && _b !== void 0 ? _b : '';
|
|
78
|
-
const peerConnectionRecord = this._peerConnections.get(peerConnection.peerConnectionId);
|
|
79
|
-
const metrics = this._metrics.get(address);
|
|
80
|
-
if (metrics) {
|
|
81
|
-
if (peerConnectionRecord) {
|
|
82
|
-
this._subtract(metrics, peerConnectionRecord);
|
|
83
|
-
}
|
|
84
|
-
if (registered) {
|
|
85
|
-
if (--metrics.numberOfPeerConnections === 0) {
|
|
86
|
-
this._metrics.delete(address);
|
|
87
|
-
this._rttAlertsOn.delete(address);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this._peerConnections.delete(peerConnection.peerConnectionId);
|
|
92
|
-
peerConnection.off('update', onUpdate);
|
|
93
|
-
});
|
|
94
|
-
peerConnection.on('update', onUpdate);
|
|
95
|
-
}
|
|
96
|
-
_checkHighRttForClients(metrics) {
|
|
97
|
-
const totalClients = metrics.numberOfPeerConnections;
|
|
98
|
-
const { percentageOfPeerConnectionsHighWatermark, percentageOfPeerConnectionsLowWatermark, minNumberOfPeerConnections, threshold } = this.config.tooHighRttAlertSettings;
|
|
99
|
-
if (metrics.numberOfPeerConnections < minNumberOfPeerConnections)
|
|
100
|
-
return;
|
|
101
|
-
const rttLt150Percentage = (metrics.numberOfPeerConnectionsRttLt150 + metrics.numberOfPeerConnectionsRttLt300 + metrics.numberOfPeerConnectionsRttOver300) / totalClients;
|
|
102
|
-
const rttLt300Percentage = (metrics.numberOfPeerConnectionsRttLt150 + metrics.numberOfPeerConnectionsRttLt300) / totalClients;
|
|
103
|
-
const rttOver300Percentage = metrics.numberOfPeerConnectionsRttOver300 / totalClients;
|
|
104
|
-
const alertOn = this._rttAlertsOn.has(metrics.sfuId);
|
|
105
|
-
switch (threshold) {
|
|
106
|
-
case 'rtt-gt-50': {
|
|
107
|
-
if (!alertOn && percentageOfPeerConnectionsHighWatermark < rttLt150Percentage) {
|
|
108
|
-
this.emit('high-rtt-started', {
|
|
109
|
-
sfuId: metrics.sfuId,
|
|
110
|
-
threshold: 'rtt-gt-50',
|
|
111
|
-
percentageOfPeerConnections: rttLt150Percentage
|
|
112
|
-
});
|
|
113
|
-
this._rttAlertsOn.add(metrics.sfuId);
|
|
114
|
-
}
|
|
115
|
-
else if (alertOn && rttLt150Percentage < percentageOfPeerConnectionsLowWatermark) {
|
|
116
|
-
this.emit('high-rtt-cleared', { sfuId: metrics.sfuId });
|
|
117
|
-
this._rttAlertsOn.delete(metrics.sfuId);
|
|
118
|
-
}
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
case 'rtt-gt-150': {
|
|
122
|
-
if (!alertOn && percentageOfPeerConnectionsHighWatermark < rttLt300Percentage) {
|
|
123
|
-
this.emit('high-rtt-started', {
|
|
124
|
-
sfuId: metrics.sfuId,
|
|
125
|
-
threshold: 'rtt-gt-150',
|
|
126
|
-
percentageOfPeerConnections: rttLt300Percentage
|
|
127
|
-
});
|
|
128
|
-
this._rttAlertsOn.add(metrics.sfuId);
|
|
129
|
-
}
|
|
130
|
-
else if (alertOn && rttLt300Percentage < percentageOfPeerConnectionsLowWatermark) {
|
|
131
|
-
this.emit('high-rtt-cleared', { sfuId: metrics.sfuId });
|
|
132
|
-
this._rttAlertsOn.delete(metrics.sfuId);
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case 'rtt-gt-300': {
|
|
137
|
-
if (!alertOn && percentageOfPeerConnectionsHighWatermark < rttOver300Percentage) {
|
|
138
|
-
this.emit('high-rtt-started', {
|
|
139
|
-
sfuId: metrics.sfuId,
|
|
140
|
-
threshold: 'rtt-gt-300',
|
|
141
|
-
percentageOfPeerConnections: rttOver300Percentage
|
|
142
|
-
});
|
|
143
|
-
this._rttAlertsOn.add(metrics.sfuId);
|
|
144
|
-
}
|
|
145
|
-
else if (alertOn && rttOver300Percentage < percentageOfPeerConnectionsLowWatermark) {
|
|
146
|
-
this.emit('high-rtt-cleared', { sfuId: metrics.sfuId });
|
|
147
|
-
this._rttAlertsOn.delete(metrics.sfuId);
|
|
148
|
-
}
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
_increase(metrics, peerConnection) {
|
|
154
|
-
metrics.sendingAudioBitrate += peerConnection.receivingAudioBitrate;
|
|
155
|
-
metrics.sendingVideoBitrate += peerConnection.receivingVideoBitrate;
|
|
156
|
-
metrics.receivingAudioBitrate += peerConnection.sendingAudioBitrate;
|
|
157
|
-
metrics.receivingVideoBitrate += peerConnection.sendingVideoBitrate;
|
|
158
|
-
metrics.receivedPacketsPerSecond += peerConnection.sendingPacketsPerSecond;
|
|
159
|
-
metrics.sentPacketsPerSecond += peerConnection.receivingPacketsPerSecond;
|
|
160
|
-
if (peerConnection.avgRttInMs) {
|
|
161
|
-
if (peerConnection.avgRttInMs < 50) {
|
|
162
|
-
++metrics.numberOfPeerConnectionsRttLt50;
|
|
163
|
-
}
|
|
164
|
-
else if (peerConnection.avgRttInMs < 150) {
|
|
165
|
-
++metrics.numberOfPeerConnectionsRttLt150;
|
|
166
|
-
}
|
|
167
|
-
else if (peerConnection.avgRttInMs < 300) {
|
|
168
|
-
++metrics.numberOfPeerConnectionsRttLt300;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
++metrics.numberOfPeerConnectionsRttOver300;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
_subtract(metrics, peerConnectionRecord) {
|
|
176
|
-
metrics.sendingAudioBitrate -= peerConnectionRecord.lastReceivingAudioBitrate;
|
|
177
|
-
metrics.sendingVideoBitrate -= peerConnectionRecord.lastReceivingVideoBitrate;
|
|
178
|
-
metrics.receivingAudioBitrate -= peerConnectionRecord.lastSendingAudioBitrate;
|
|
179
|
-
metrics.receivingVideoBitrate -= peerConnectionRecord.lastSendingVideoBitrate;
|
|
180
|
-
metrics.receivedPacketsPerSecond -= peerConnectionRecord.lastSendingPacketsPerSecond;
|
|
181
|
-
metrics.sentPacketsPerSecond -= peerConnectionRecord.lastReceivingPacketsPerSecond;
|
|
182
|
-
if (peerConnectionRecord.lastAvgRttInMs) {
|
|
183
|
-
if (peerConnectionRecord.lastAvgRttInMs < 50) {
|
|
184
|
-
--metrics.numberOfPeerConnectionsRttLt50;
|
|
185
|
-
}
|
|
186
|
-
else if (peerConnectionRecord.lastAvgRttInMs < 150) {
|
|
187
|
-
--metrics.numberOfPeerConnectionsRttLt150;
|
|
188
|
-
}
|
|
189
|
-
else if (peerConnectionRecord.lastAvgRttInMs < 300) {
|
|
190
|
-
--metrics.numberOfPeerConnectionsRttLt300;
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
--metrics.numberOfPeerConnectionsRttOver300;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
exports.SfuServerMonitor = SfuServerMonitor;
|