@flashphoner/sfusdk 2.0.330 → 2.0.331
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/client.version +1 -1
- package/dist/sdk/connection.d.ts +4 -2
- package/dist/sdk/connection.js +23 -0
- package/dist/sdk/connection.js.map +1 -1
- package/dist/sdk/constants.d.ts +13 -2
- package/dist/sdk/constants.js +2 -0
- package/dist/sdk/constants.js.map +1 -1
- package/dist/sdk/room-extended.d.ts +2 -1
- package/dist/sdk/room-extended.js +2 -2
- package/dist/sdk/room-extended.js.map +1 -1
- package/dist/sdk/room.d.ts +2 -2
- package/dist/sdk/room.js +35 -16
- package/dist/sdk/room.js.map +1 -1
- package/dist/sdk/sfu-extended.d.ts +2 -0
- package/dist/sdk/sfu-extended.js +5 -4
- package/dist/sdk/sfu-extended.js.map +1 -1
- package/dist/sdk/sfu.js +6 -0
- package/dist/sdk/sfu.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/connection.Connection.html +4 -2
- package/docs/classes/room.Room.html +11 -10
- package/docs/classes/room_extended.RoomExtended.html +35 -34
- package/docs/classes/sfu.Sfu.html +1 -1
- package/docs/classes/sfu_extended.SfuExtended.html +104 -104
- package/docs/enums/constants.AttachmentState.html +2 -2
- package/docs/enums/constants.AttachmentType.html +2 -2
- package/docs/enums/constants.AuthenticationStatus.html +2 -2
- package/docs/enums/constants.ChannelSendPolicy.html +2 -2
- package/docs/enums/constants.ChatError.html +2 -2
- package/docs/enums/constants.ChatReceivePolicy.html +2 -2
- package/docs/enums/constants.ChatSectionsError.html +2 -2
- package/docs/enums/constants.ChatType.html +2 -2
- package/docs/enums/constants.ConferenceType.html +2 -2
- package/docs/enums/constants.ConnectionError.html +2 -2
- package/docs/enums/constants.ConnectionType.html +2 -2
- package/docs/enums/constants.ContactError.html +2 -2
- package/docs/enums/constants.DeliveryStatus.html +2 -2
- package/docs/enums/constants.ExamplesError.html +2 -2
- package/docs/enums/constants.ExamplesEvent.html +2 -2
- package/docs/enums/constants.InternalApi.html +3 -2
- package/docs/enums/constants.MeetingSyncEvent.html +11 -11
- package/docs/enums/constants.MessageAttachmentMediaType.html +2 -2
- package/docs/enums/constants.MessageAttachmentType.html +2 -2
- package/docs/enums/constants.MessageState.html +2 -2
- package/docs/enums/constants.MessageTargetEntityType.html +2 -2
- package/docs/enums/constants.MessageType.html +2 -2
- package/docs/enums/constants.NotificationMode.html +2 -2
- package/docs/enums/constants.Operations.html +2 -2
- package/docs/enums/constants.ParticipantRole.html +2 -2
- package/docs/enums/constants.PresenceStatus.html +2 -2
- package/docs/enums/constants.RemoteSdpType.html +2 -2
- package/docs/enums/constants.RoomError.html +2 -2
- package/docs/enums/constants.RoomEvent.html +44 -43
- package/docs/enums/constants.RoomState.html +2 -2
- package/docs/enums/constants.SfuEvent.html +64 -64
- package/docs/enums/constants.SortOrder.html +2 -2
- package/docs/enums/constants.SpaceError.html +2 -2
- package/docs/enums/constants.SpaceEvent.html +38 -38
- package/docs/enums/constants.State.html +2 -2
- package/docs/enums/constants.StatsType.html +2 -2
- package/docs/enums/constants.TrackType.html +2 -2
- package/docs/enums/constants.TransportType.html +2 -2
- package/docs/enums/constants.UserInfoError.html +2 -2
- package/docs/enums/constants.UserManagementError.html +2 -2
- package/docs/interfaces/room.RemoteTrack.html +2 -2
- package/docs/modules/constants.html +2 -0
- package/docs/types/connection.InitialUserData.html +1 -1
- package/docs/types/constants.AddRemoveTracks.html +1 -1
- package/docs/types/constants.AddRemoveTracksSync.html +1 -1
- package/docs/types/constants.AddedMembersToThread.html +1 -1
- package/docs/types/constants.AddedRemovedReactionOnMessage.html +1 -1
- package/docs/types/constants.AddedRoleToMember.html +1 -1
- package/docs/types/constants.Attachment.html +1 -1
- package/docs/types/constants.AttachmentInfo.html +1 -1
- package/docs/types/constants.AttachmentListItem.html +1 -1
- package/docs/types/constants.AttachmentListResult.html +1 -1
- package/docs/types/constants.AttachmentRequest.html +1 -1
- package/docs/types/constants.AttachmentRequestAck.html +1 -1
- package/docs/types/constants.AttachmentSizeInfo.html +1 -1
- package/docs/types/constants.AttachmentStatus.html +1 -1
- package/docs/types/constants.AttachmentStatusEvent.html +1 -1
- package/docs/types/constants.AuthenticationStatusEvent.html +1 -1
- package/docs/types/constants.BannedContact.html +1 -1
- package/docs/types/constants.BitrateTestStatus.html +1 -1
- package/docs/types/constants.BooleanEvent.html +1 -1
- package/docs/types/constants.Calendar.html +1 -1
- package/docs/types/constants.CalendarEvent.html +1 -1
- package/docs/types/constants.CalendarEventEvent.html +1 -1
- package/docs/types/constants.ChannelMuted.html +1 -1
- package/docs/types/constants.ChannelNotificationSettingsUpdated.html +1 -1
- package/docs/types/constants.ChannelUnmuted.html +1 -1
- package/docs/types/constants.Chat.html +1 -1
- package/docs/types/constants.ChatIconUpdated.html +1 -1
- package/docs/types/constants.ChatLoadedEvent.html +1 -1
- package/docs/types/constants.ChatMap.html +1 -1
- package/docs/types/constants.ChatMessagesCount.html +1 -1
- package/docs/types/constants.ChatMessagesEvent.html +1 -1
- package/docs/types/constants.ChatMuted.html +1 -1
- package/docs/types/constants.ChatNotificationSettingsUpdated.html +1 -1
- package/docs/types/constants.ChatSearchResultEvent.html +1 -1
- package/docs/types/constants.ChatUnmuted.html +1 -1
- package/docs/types/constants.ChatsEvent.html +1 -1
- package/docs/types/constants.ConnectionDetails.html +1 -1
- package/docs/types/constants.ConnectionFailedEvent.html +1 -1
- package/docs/types/constants.Contact.html +1 -1
- package/docs/types/constants.ContactDeleted.html +1 -1
- package/docs/types/constants.ContactPersonalSettings.html +1 -1
- package/docs/types/constants.ContactPersonalSettingsUpdated.html +1 -1
- package/docs/types/constants.ContactUpdated.html +1 -1
- package/docs/types/constants.ControlMessage.html +1 -1
- package/docs/types/constants.ControlMessageEvent.html +1 -1
- package/docs/types/constants.CreatedRoom.html +1 -1
- package/docs/types/constants.EvictedFromRoom.html +1 -1
- package/docs/types/constants.EvictedSync.html +1 -1
- package/docs/types/constants.ExamplesUser.html +1 -1
- package/docs/types/constants.ExamplesUserEvent.html +1 -1
- package/docs/types/constants.FirstAndLastChatMessage.html +1 -1
- package/docs/types/constants.ForcefullyLeftEvent.html +1 -1
- package/docs/types/constants.FragmentedMessage.html +1 -1
- package/docs/types/constants.FriendInvite.html +1 -1
- package/docs/types/constants.FriendInviteDeleted.html +1 -1
- package/docs/types/constants.InternalMessage.html +1 -1
- package/docs/types/constants.JoinedRoom.html +1 -1
- package/docs/types/constants.JoinedRoomSync.html +1 -1
- package/docs/types/constants.LastReadMessageUpdate.html +1 -1
- package/docs/types/constants.LastReadMessageUpdated.html +1 -1
- package/docs/types/constants.LeftMeetingSync.html +1 -1
- package/docs/types/constants.LeftRoom.html +1 -1
- package/docs/types/constants.LoadMessagesWithMentionsResult.html +1 -1
- package/docs/types/constants.MeetingAddedToHistory.html +1 -1
- package/docs/types/constants.MeetingEndedSync.html +1 -1
- package/docs/types/constants.MeetingHistoryItem.html +1 -1
- package/docs/types/constants.MeetingNameUpdatedSync.html +1 -1
- package/docs/types/constants.MeetingRecordDeleted.html +1 -1
- package/docs/types/constants.MeetingRemovedFromHistory.html +1 -1
- package/docs/types/constants.MeetingsHistoryEvent.html +1 -1
- package/docs/types/constants.MeetingsPreviewEvent.html +1 -1
- package/docs/types/constants.Message.html +1 -1
- package/docs/types/constants.MessageAttachment.html +1 -1
- package/docs/types/constants.MessageAttachmentData.html +1 -1
- package/docs/types/constants.MessageAttachmentsSearchResult.html +1 -1
- package/docs/types/constants.MessageDeleted.html +1 -1
- package/docs/types/constants.MessageDeliveryStatus.html +1 -1
- package/docs/types/constants.MessageEdited.html +1 -1
- package/docs/types/constants.MessageInfo.html +1 -1
- package/docs/types/constants.MessageReaction.html +1 -1
- package/docs/types/constants.MessageStatus.html +1 -1
- package/docs/types/constants.MessageStatusEvent.html +1 -1
- package/docs/types/constants.MessageStatusUpdate.html +1 -1
- package/docs/types/constants.MessageTargetEntityId.html +1 -1
- package/docs/types/constants.MessageWithUploadingAttachments.html +1 -1
- package/docs/types/constants.MuteSettings.html +1 -1
- package/docs/types/constants.NewChatEvent.html +1 -1
- package/docs/types/constants.NewContact.html +1 -1
- package/docs/types/constants.NewFriendInvite.html +1 -1
- package/docs/types/constants.NewMeeting.html +1 -1
- package/docs/types/constants.NewSpaceCategoryEvent.html +1 -1
- package/docs/types/constants.NewSpaceChannelEvent.html +1 -1
- package/docs/types/constants.NewSpaceEvent.html +1 -1
- package/docs/types/constants.NewSpaceRoleAdded.html +1 -1
- package/docs/types/constants.NewSpaceThreadEvent.html +1 -1
- package/docs/types/constants.OperationFailed.html +1 -1
- package/docs/types/constants.OperationFailedEvent.html +1 -1
- package/docs/types/constants.Participant.html +1 -1
- package/docs/types/constants.ParticipantAVSMutedEvent.html +1 -1
- package/docs/types/constants.ParticipantConfigEvent.html +1 -1
- package/docs/types/constants.ParticipantRenamed.html +1 -1
- package/docs/types/constants.ParticipantRenamedSyncEvent.html +1 -1
- package/docs/types/constants.ParticipantsListEvent.html +1 -1
- package/docs/types/constants.ParticipantsListSyncEvent.html +1 -1
- package/docs/types/constants.PlacedInLobbyEvent.html +1 -1
- package/docs/types/constants.PlacedInWaitingRoomEvent.html +1 -1
- package/docs/types/constants.PublicChannelsEvent.html +1 -1
- package/docs/types/constants.Quality.html +1 -1
- package/docs/types/constants.RTCMetricsDescriptionUpdate.html +1 -0
- package/docs/types/constants.RTCMetricsTokenRefresh.html +1 -0
- package/docs/types/constants.RecordInfo.html +1 -1
- package/docs/types/constants.RecorderConfig.html +1 -1
- package/docs/types/constants.RemoteSdp.html +1 -1
- package/docs/types/constants.RemoteSdpInfo.html +1 -1
- package/docs/types/constants.RemovedChatEvent.html +1 -1
- package/docs/types/constants.RemovedMemberFromThread.html +1 -1
- package/docs/types/constants.RemovedRoleFromMember.html +1 -1
- package/docs/types/constants.ResetPasswordRequestStatus.html +1 -1
- package/docs/types/constants.RoleAssigned.html +1 -1
- package/docs/types/constants.RolePermissionSectionsEvent.html +1 -1
- package/docs/types/constants.RolesListEvent.html +1 -1
- package/docs/types/constants.RoomAvailable.html +1 -1
- package/docs/types/constants.RoomConfigEvent.html +1 -1
- package/docs/types/constants.RoomExtendedConfig.html +1 -1
- package/docs/types/constants.RoomExtendedParticipantConfig.html +1 -1
- package/docs/types/constants.RoomExtendedParticipantsConfig.html +1 -1
- package/docs/types/constants.RoomExtendedScreenSharingConfig.html +1 -1
- package/docs/types/constants.RoomInfo.html +1 -1
- package/docs/types/constants.RoomMessage.html +1 -1
- package/docs/types/constants.RoomNameUpdated.html +1 -1
- package/docs/types/constants.RoomScreenSharingConfigEvent.html +1 -1
- package/docs/types/constants.SFUMeetingParticipantPreview.html +1 -1
- package/docs/types/constants.SFUMeetingPreview.html +1 -1
- package/docs/types/constants.SfuMessageEvent.html +1 -1
- package/docs/types/constants.SfuSpace.html +1 -1
- package/docs/types/constants.SfuSpaceCategory.html +1 -1
- package/docs/types/constants.SfuSpaceChannel.html +1 -1
- package/docs/types/constants.SfuSpaceChannelAccessRights.html +1 -1
- package/docs/types/constants.SfuSpaceInvite.html +1 -1
- package/docs/types/constants.SfuSpaceMember.html +1 -1
- package/docs/types/constants.SfuSpaceRole.html +1 -1
- package/docs/types/constants.SfuSpaceRolePermission.html +1 -1
- package/docs/types/constants.SfuSpaceRolePermissionSection.html +1 -1
- package/docs/types/constants.SfuSpaceThread.html +1 -1
- package/docs/types/constants.SfuSpaceUserBan.html +1 -1
- package/docs/types/constants.SignUpStatus.html +1 -1
- package/docs/types/constants.SpaceCategoryDeleted.html +1 -1
- package/docs/types/constants.SpaceCategoryUpdated.html +1 -1
- package/docs/types/constants.SpaceChannelDeleted.html +1 -1
- package/docs/types/constants.SpaceChannelMoved.html +1 -1
- package/docs/types/constants.SpaceChannelUpdated.html +1 -1
- package/docs/types/constants.SpaceCreatedEvent.html +1 -1
- package/docs/types/constants.SpaceDeletedEvent.html +1 -1
- package/docs/types/constants.SpaceInviteCreated.html +1 -1
- package/docs/types/constants.SpaceInviteRevoked.html +1 -1
- package/docs/types/constants.SpaceMuted.html +1 -1
- package/docs/types/constants.SpaceNotificationSettingsUpdated.html +1 -1
- package/docs/types/constants.SpaceOverviewUpdated.html +1 -1
- package/docs/types/constants.SpaceRoleDeleted.html +1 -1
- package/docs/types/constants.SpaceRoleUpdated.html +1 -1
- package/docs/types/constants.SpaceThreadDeleted.html +1 -1
- package/docs/types/constants.SpaceThreadUpdated.html +1 -1
- package/docs/types/constants.SpaceUnmuted.html +1 -1
- package/docs/types/constants.StopScreenSharingEvent.html +1 -1
- package/docs/types/constants.StopTrackEvent.html +1 -1
- package/docs/types/constants.SystemConfig.html +1 -1
- package/docs/types/constants.SystemConfigEvent.html +1 -1
- package/docs/types/constants.ThreadMuted.html +1 -1
- package/docs/types/constants.ThreadNotificationSettingsUpdated.html +1 -1
- package/docs/types/constants.ThreadUnmuted.html +1 -1
- package/docs/types/constants.TracksQualityState.html +1 -1
- package/docs/types/constants.UnreadMessagesCountEvent.html +1 -1
- package/docs/types/constants.UnreadMessagesCountUpdate.html +1 -1
- package/docs/types/constants.UpdateChatEvent.html +1 -1
- package/docs/types/constants.UpdateMessagesDeliveryStatusEvent.html +1 -1
- package/docs/types/constants.UploadIconEvent.html +1 -1
- package/docs/types/constants.UploadingAttachmentInfo.html +1 -1
- package/docs/types/constants.UserCalendarEvent.html +1 -1
- package/docs/types/constants.UserChatEncryptedPassword.html +1 -1
- package/docs/types/constants.UserContacts.html +1 -1
- package/docs/types/constants.UserContactsEvent.html +1 -1
- package/docs/types/constants.UserEmail.html +1 -1
- package/docs/types/constants.UserEncryptionInfo.html +1 -1
- package/docs/types/constants.UserEncryptionInfoEvent.html +1 -1
- package/docs/types/constants.UserHostKey.html +1 -1
- package/docs/types/constants.UserHostKeyChangedEvent.html +1 -1
- package/docs/types/constants.UserId.html +1 -1
- package/docs/types/constants.UserInfo.html +1 -1
- package/docs/types/constants.UserInfoChangedEvent.html +1 -1
- package/docs/types/constants.UserInfoEvent.html +1 -1
- package/docs/types/constants.UserJoinedToSpaceEvent.html +1 -1
- package/docs/types/constants.UserLeftSpace.html +1 -1
- package/docs/types/constants.UserNickname.html +1 -1
- package/docs/types/constants.UserNicknameChangedEvent.html +1 -1
- package/docs/types/constants.UserPassword.html +1 -1
- package/docs/types/constants.UserPhoneNumber.html +1 -1
- package/docs/types/constants.UserPhoneNumberChangedEvent.html +1 -1
- package/docs/types/constants.UserPmiSettings.html +1 -1
- package/docs/types/constants.UserPresenceStatusUpdated.html +1 -1
- package/docs/types/constants.UserRoomsEvent.html +1 -1
- package/docs/types/constants.UserSpaceNicknameUpdated.html +1 -1
- package/docs/types/constants.UserSpacesEvent.html +1 -1
- package/docs/types/constants.UserSpecificChatInfo.html +1 -1
- package/docs/types/constants.UserTimezone.html +1 -1
- package/docs/types/constants.UserTimezoneChangedEvent.html +1 -1
- package/docs/types/constants.WaitingListEvent.html +1 -1
- package/docs/types/constants.WaitingParticipant.html +1 -1
- package/docs/types/constants.WaitingRoomUpdate.html +1 -1
- package/docs/types/sfu_extended.EventUnion.html +1 -1
- package/docs/types/sfu_extended.NotifyUnion.html +1 -1
- package/docs/variables/constants.ATTACHMENT_CHUNK_SIZE.html +1 -1
- package/docs/variables/constants.ATTACHMENT_ID_LENGTH.html +1 -1
- package/docs/variables/constants.WS_CONNECTION_TIMEOUT.html +1 -1
- package/docs/variables/constants.WS_PINGS_MISSING_THRESHOLD.html +1 -1
- package/docs/variables/constants.WS_PING_INTERVAL_MS.html +1 -1
- package/package.json +2 -1
- package/dist/sdk/metrics/batch.d.ts +0 -44
- package/dist/sdk/metrics/batch.js +0 -81
- package/dist/sdk/metrics/batch.js.map +0 -1
- package/dist/sdk/metrics/collector.d.ts +0 -121
- package/dist/sdk/metrics/collector.js +0 -332
- package/dist/sdk/metrics/collector.js.map +0 -1
- package/dist/sdk/metrics/compressor.d.ts +0 -36
- package/dist/sdk/metrics/compressor.js +0 -40
- package/dist/sdk/metrics/compressor.js.map +0 -1
- package/dist/sdk/metrics/constants.d.ts +0 -97
- package/dist/sdk/metrics/constants.js +0 -54
- package/dist/sdk/metrics/constants.js.map +0 -1
- package/dist/sdk/metrics/filter.d.ts +0 -46
- package/dist/sdk/metrics/filter.js +0 -51
- package/dist/sdk/metrics/filter.js.map +0 -1
- package/dist/sdk/metrics/message.d.ts +0 -23
- package/dist/sdk/metrics/message.js +0 -12
- package/dist/sdk/metrics/message.js.map +0 -1
- package/dist/sdk/metrics/sender.d.ts +0 -37
- package/dist/sdk/metrics/sender.js +0 -82
- package/dist/sdk/metrics/sender.js.map +0 -1
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RTCMetricsCollector = void 0;
|
|
13
|
-
const batch_1 = require("./batch");
|
|
14
|
-
const compressor_1 = require("./compressor");
|
|
15
|
-
const sender_1 = require("./sender");
|
|
16
|
-
const async_mutex_1 = require("async-mutex");
|
|
17
|
-
const constants_1 = require("./constants");
|
|
18
|
-
/**
|
|
19
|
-
* Collects WebRTC statistics from an RTCPeerConnection and sends them
|
|
20
|
-
* to a backend system according to the provided server description.
|
|
21
|
-
*
|
|
22
|
-
* Responsibilities:
|
|
23
|
-
* - Extract valid metrics based on server-defined rules
|
|
24
|
-
* - Batch and compress metrics before sending
|
|
25
|
-
* - Apply report filters
|
|
26
|
-
* - Detect header changes and notify the server
|
|
27
|
-
* - Schedule periodic metric collection
|
|
28
|
-
*/
|
|
29
|
-
class RTCMetricsCollector {
|
|
30
|
-
/**
|
|
31
|
-
* Creates a metrics collector instance.
|
|
32
|
-
*
|
|
33
|
-
* @param id media session identifier
|
|
34
|
-
* @param webRTCMetricsServerDescription collection and transport rules
|
|
35
|
-
* @param peerConnection WebRTC peer connection source of stats
|
|
36
|
-
* @param connection WebSocket connection (if used)
|
|
37
|
-
* @param logger logging facility
|
|
38
|
-
* @param maxErrors max allowed send errors (legacy argument)
|
|
39
|
-
*/
|
|
40
|
-
constructor(id, webRTCMetricsServerDescription, peerConnection, connection, logger, maxErrors) {
|
|
41
|
-
this._logger = logger;
|
|
42
|
-
this._connection = connection;
|
|
43
|
-
this._description = webRTCMetricsServerDescription;
|
|
44
|
-
this._mediaSessionId = id;
|
|
45
|
-
this._peerConnection = peerConnection;
|
|
46
|
-
this._headers = "";
|
|
47
|
-
this._errorsCount = 0;
|
|
48
|
-
this._maxErrors = maxErrors;
|
|
49
|
-
this._reportFilters = [];
|
|
50
|
-
this._mutex = new async_mutex_1.Mutex();
|
|
51
|
-
this._collectMetrics = this._collectMetrics.bind(this);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Starts collecting and sending metrics.
|
|
55
|
-
* Validates server description and initializes internal fields.
|
|
56
|
-
*/
|
|
57
|
-
start() {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
this._logger.info(constants_1.LOG_PREFIX, "Startup collecting metrics");
|
|
60
|
-
this._validateBeforeStartup();
|
|
61
|
-
yield this._initializeFields();
|
|
62
|
-
yield this._sendHeaders();
|
|
63
|
-
if (this._description.collect === constants_1.RTCMetricsCollect.on) {
|
|
64
|
-
this.collect(true);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Stops periodic metrics collection and resets internal state.
|
|
70
|
-
*/
|
|
71
|
-
stop() {
|
|
72
|
-
this._logger.info(constants_1.LOG_PREFIX, "Stopping collecting metrics");
|
|
73
|
-
this.collect(false);
|
|
74
|
-
this._resetFields();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Enables or disables periodic stats sampling.
|
|
78
|
-
*
|
|
79
|
-
* @param enable whether sampling should be active
|
|
80
|
-
*/
|
|
81
|
-
collect(enable) {
|
|
82
|
-
this._logger.info(constants_1.LOG_PREFIX, "Collecting state changed: ", enable ? "enabled" : "disabled");
|
|
83
|
-
if (enable) {
|
|
84
|
-
if (this._metricsScheduler == null) {
|
|
85
|
-
this._metricsScheduler = setInterval(this._collectMetrics, this._description.sampling);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
if (this._metricsScheduler != null) {
|
|
90
|
-
clearInterval(this._metricsScheduler);
|
|
91
|
-
this._metricsScheduler = null;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Adds a custom report filter.
|
|
97
|
-
* A report is ignored if any filter rejects it.
|
|
98
|
-
*
|
|
99
|
-
* @param filter filter instance
|
|
100
|
-
*/
|
|
101
|
-
addStatsReportFilter(filter) {
|
|
102
|
-
this._reportFilters.push(filter);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Ensures required fields are present before collector startup.
|
|
106
|
-
* Throws descriptive errors if configuration is incomplete.
|
|
107
|
-
*/
|
|
108
|
-
_validateBeforeStartup() {
|
|
109
|
-
let error = "Can't collect WebRTC stats to send: ";
|
|
110
|
-
if (!this._description.types) {
|
|
111
|
-
throw new Error(error + "no report types defined");
|
|
112
|
-
}
|
|
113
|
-
if (!this._description.sampling) {
|
|
114
|
-
throw new Error(error + "no sampling interval defined");
|
|
115
|
-
}
|
|
116
|
-
if (!this._description.batchSize) {
|
|
117
|
-
throw new Error(error + "no metrics batch size defined");
|
|
118
|
-
}
|
|
119
|
-
if (!this._peerConnection) {
|
|
120
|
-
throw new Error(error + "no RTCPeerConnection available");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Initializes sender, compressor, batch and header structure.
|
|
125
|
-
*/
|
|
126
|
-
_initializeFields() {
|
|
127
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
if (this._description.ingestPoint) {
|
|
129
|
-
if (this._description.ingestPoint.startsWith(constants_1.CONNECTION_TYPE.HTTP)) {
|
|
130
|
-
this._metricsSender = new sender_1.RTCMetricsHttpSender(this._description.ingestPoint, this._description.authorization
|
|
131
|
-
? { Authorization: this._description.authorization }
|
|
132
|
-
: null);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
throw new Error("Unsupported connection type for collector described in ingestPoint");
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
this._metricsSender = new sender_1.RTCMetricsWebsocketSender(this._connection);
|
|
140
|
-
}
|
|
141
|
-
if (this._description.compression &&
|
|
142
|
-
this._description.compression.includes(constants_1.RTCMetricsCompressionType.gzip)) {
|
|
143
|
-
this._compressor = new compressor_1.GzipRTCMetricsCompressor();
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this._compressor = new compressor_1.NoneRTCMetricsCompressor();
|
|
147
|
-
}
|
|
148
|
-
this._batch = new batch_1.RTCMetricsBatch(this._description.batchSize);
|
|
149
|
-
this._headers = yield this._extractHeaders(yield this._peerConnection.getStats(), this._description);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Extracts all valid metrics headers from the RTCStatsReport,
|
|
154
|
-
* respecting type constraints, filters and "contains" conditions.
|
|
155
|
-
*
|
|
156
|
-
* @returns serialized header string
|
|
157
|
-
*/
|
|
158
|
-
_extractHeaders(stats, description) {
|
|
159
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
return Object.entries(description.types).reduce((accumulator, [typename, descriptor]) => {
|
|
161
|
-
stats.forEach((report) => {
|
|
162
|
-
if (this._mismatchTypename(report, typename) ||
|
|
163
|
-
this._mismatchContains(report, descriptor.contains) ||
|
|
164
|
-
this._mismatchFilters(report)) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
accumulator = descriptor.metrics
|
|
168
|
-
.split(constants_1.RTCMetricsDelimiter.HEADERS)
|
|
169
|
-
.reduce((acc, metricName) => {
|
|
170
|
-
if (this._isNullOrUndefined(report[metricName])) {
|
|
171
|
-
return acc;
|
|
172
|
-
}
|
|
173
|
-
return (acc + (acc.length ? constants_1.RTCMetricsDelimiter.HEADERS : "") + `${report.type}.${report.id}.${metricName}`);
|
|
174
|
-
}, accumulator);
|
|
175
|
-
});
|
|
176
|
-
return accumulator;
|
|
177
|
-
}, "");
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Periodic sampling routine:
|
|
182
|
-
* - extracts stats
|
|
183
|
-
* - checks for header changes
|
|
184
|
-
* - accumulates metrics
|
|
185
|
-
* - flushes on mismatch or batch size reached
|
|
186
|
-
*/
|
|
187
|
-
_collectMetrics() {
|
|
188
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
const unlock = yield this._mutex.acquire();
|
|
190
|
-
try {
|
|
191
|
-
let stats = yield this._peerConnection.getStats();
|
|
192
|
-
let headers = yield this._extractHeaders(stats, this._description);
|
|
193
|
-
if (this._headers != headers) {
|
|
194
|
-
this._headers = headers;
|
|
195
|
-
yield this._sendMetricsAndFlushBatch();
|
|
196
|
-
yield this._sendHeaders();
|
|
197
|
-
}
|
|
198
|
-
if (!this._headers.length) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
let metrics = [];
|
|
202
|
-
let lostMetrics = [];
|
|
203
|
-
this._headers.split(constants_1.RTCMetricsDelimiter.HEADERS).forEach((header) => {
|
|
204
|
-
let components = header.split(".");
|
|
205
|
-
if (components.length != 3) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
let descriptor = {
|
|
209
|
-
type: components[0],
|
|
210
|
-
id: components[1],
|
|
211
|
-
name: components[2]
|
|
212
|
-
};
|
|
213
|
-
let value = undefined;
|
|
214
|
-
stats.forEach((report) => {
|
|
215
|
-
if (report.id == descriptor.id) {
|
|
216
|
-
value = report[descriptor.name];
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
if (this._isNullOrUndefined(value)) {
|
|
220
|
-
lostMetrics.push(descriptor);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
metrics.push(this._stringifyValue(value));
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
if (lostMetrics.length) {
|
|
227
|
-
this._logger.error(constants_1.LOG_PREFIX, "Failed to fully collect the stated metrics. Send correctly accumulated metrics ahead of time");
|
|
228
|
-
yield this._sendMetricsAndFlushBatch();
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this._batch.addMetrics(metrics);
|
|
232
|
-
if (this._batch.fulfilled()) {
|
|
233
|
-
yield this._sendMetricsAndFlushBatch();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
finally {
|
|
238
|
-
unlock();
|
|
239
|
-
}
|
|
240
|
-
if (this._errorsCount > this._maxErrors) {
|
|
241
|
-
this.stop();
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Sends the current header structure to the server.
|
|
247
|
-
*/
|
|
248
|
-
_sendHeaders() {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
this._logger.info(constants_1.LOG_PREFIX, "Send headers:", this._headers);
|
|
251
|
-
yield this._metricsSender.sendDescription({
|
|
252
|
-
headers: this._headers,
|
|
253
|
-
compression: this._compressor.type.toString(),
|
|
254
|
-
mediaSessionId: this._mediaSessionId
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Compresses, deduplicates and sends the current metrics batch.
|
|
260
|
-
* Resets batch afterwards.
|
|
261
|
-
*/
|
|
262
|
-
_sendMetricsAndFlushBatch() {
|
|
263
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
-
if (this._batch.empty()) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
this._batch.deduplicate();
|
|
268
|
-
const status = yield this._metricsSender.sendBatch({
|
|
269
|
-
mediaSessionId: this._mediaSessionId,
|
|
270
|
-
metrics: this._compressor.compress(this._batch)
|
|
271
|
-
});
|
|
272
|
-
if (status == constants_1.CONNECTION_STATUS.OK) {
|
|
273
|
-
this._logger.debug(constants_1.LOG_PREFIX, "Successfully sent metrics batch");
|
|
274
|
-
this._errorsCount = 0;
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this._logger.error(constants_1.LOG_PREFIX, "Failed to send metrics batch with status:", status);
|
|
278
|
-
this._errorsCount++;
|
|
279
|
-
}
|
|
280
|
-
this._batch.release();
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Converts metric values to string form.
|
|
285
|
-
*/
|
|
286
|
-
_stringifyValue(value) {
|
|
287
|
-
if (typeof value === "object") {
|
|
288
|
-
return JSON.stringify(value);
|
|
289
|
-
}
|
|
290
|
-
return value.toString();
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Checks if stats report type matches required type.
|
|
294
|
-
*/
|
|
295
|
-
_mismatchTypename(report, typename) {
|
|
296
|
-
return report.type !== typename;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Checks "contains" rules within metric type description.
|
|
300
|
-
*/
|
|
301
|
-
_mismatchContains(report, contains) {
|
|
302
|
-
return (contains &&
|
|
303
|
-
Object.entries(contains).some(([field, desiredValues]) => {
|
|
304
|
-
if (!report[field]) {
|
|
305
|
-
return true;
|
|
306
|
-
}
|
|
307
|
-
return !desiredValues.includes(report[field]);
|
|
308
|
-
}));
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Applies custom filters to the stats report.
|
|
312
|
-
*/
|
|
313
|
-
_mismatchFilters(report) {
|
|
314
|
-
return this._reportFilters.some((filter) => !filter.allowed(report));
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Checks for null or undefined values.
|
|
318
|
-
*/
|
|
319
|
-
_isNullOrUndefined(value) {
|
|
320
|
-
return value === undefined || value === null;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Reset fields
|
|
324
|
-
*/
|
|
325
|
-
_resetFields() {
|
|
326
|
-
this._headers = "";
|
|
327
|
-
this._batch.release();
|
|
328
|
-
this._errorsCount = 0;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
exports.RTCMetricsCollector = RTCMetricsCollector;
|
|
332
|
-
//# sourceMappingURL=collector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../../src/sdk/metrics/collector.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mCAAwC;AACxC,6CAAuG;AACvG,qCAA4F;AAE5F,6CAAkC;AAClC,2CASqB;AAGrB;;;;;;;;;;GAUG;AACH,MAAa,mBAAmB;IAgB5B;;;;;;;;;OASG;IACH,YACI,EAAU,EACV,8BAA2D,EAC3D,cAAiC,EACjC,UAAsB,EACtB,MAAc,EACd,SAAiB;QAEjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,8BAA8B,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QAEtC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;Q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;QACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,MAAW,EAAE,QAAgB;QACnD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;IACpC,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,MAAW,EAAE,QAAgC;QACnE,OAAO,CACH,QAAQ;YACR,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,EAAE;gBACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;oBAChB,OAAO,IAAI,CAAC;iBACf;gBACD,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAClD,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,MAAW;QAChC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,KAAU;QACjC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;IACjD,CAAC;IAED;;OAEG;IACK,YAAY;QAChB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ;AAjWD,kDAiWC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { RTCMetricsBatch } from "./batch";
|
|
2
|
-
import { RTCMetricsCompressionType } from "./constants";
|
|
3
|
-
export interface IRTCMetricsCompressor {
|
|
4
|
-
/**
|
|
5
|
-
* Accepts a filled metrics batch and returns a serialized payload,
|
|
6
|
-
* optionally applying compression.
|
|
7
|
-
*/
|
|
8
|
-
compress(batch: RTCMetricsBatch): string;
|
|
9
|
-
/**
|
|
10
|
-
* Compression type identifier so the receiver knows
|
|
11
|
-
* how to decode the payload.
|
|
12
|
-
*/
|
|
13
|
-
get type(): RTCMetricsCompressionType;
|
|
14
|
-
}
|
|
15
|
-
export declare class NoneRTCMetricsCompressor implements IRTCMetricsCompressor {
|
|
16
|
-
/**
|
|
17
|
-
* Produces a plain JSON string from the batch
|
|
18
|
-
* without any compression applied.
|
|
19
|
-
*/
|
|
20
|
-
compress(batch: RTCMetricsBatch): string;
|
|
21
|
-
get type(): RTCMetricsCompressionType;
|
|
22
|
-
}
|
|
23
|
-
export declare class GzipRTCMetricsCompressor implements IRTCMetricsCompressor {
|
|
24
|
-
/**
|
|
25
|
-
* Compresses the flattened batch with gzip (via pako),
|
|
26
|
-
* then converts the resulting binary data to a base64 string.
|
|
27
|
-
*
|
|
28
|
-
* Flow:
|
|
29
|
-
* 1. Flatten batch (batched metrics stored as arrays)
|
|
30
|
-
* 2. Convert JSON → UTF-8 bytes
|
|
31
|
-
* 3. Apply gzip
|
|
32
|
-
* 4. Convert compressed Uint8Array → binary string → base64
|
|
33
|
-
*/
|
|
34
|
-
compress(batch: RTCMetricsBatch): string;
|
|
35
|
-
get type(): RTCMetricsCompressionType;
|
|
36
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GzipRTCMetricsCompressor = exports.NoneRTCMetricsCompressor = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const pako_1 = require("pako");
|
|
6
|
-
class NoneRTCMetricsCompressor {
|
|
7
|
-
/**
|
|
8
|
-
* Produces a plain JSON string from the batch
|
|
9
|
-
* without any compression applied.
|
|
10
|
-
*/
|
|
11
|
-
compress(batch) {
|
|
12
|
-
return JSON.stringify(batch.flat());
|
|
13
|
-
}
|
|
14
|
-
get type() {
|
|
15
|
-
return constants_1.RTCMetricsCompressionType.none;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.NoneRTCMetricsCompressor = NoneRTCMetricsCompressor;
|
|
19
|
-
class GzipRTCMetricsCompressor {
|
|
20
|
-
/**
|
|
21
|
-
* Compresses the flattened batch with gzip (via pako),
|
|
22
|
-
* then converts the resulting binary data to a base64 string.
|
|
23
|
-
*
|
|
24
|
-
* Flow:
|
|
25
|
-
* 1. Flatten batch (batched metrics stored as arrays)
|
|
26
|
-
* 2. Convert JSON → UTF-8 bytes
|
|
27
|
-
* 3. Apply gzip
|
|
28
|
-
* 4. Convert compressed Uint8Array → binary string → base64
|
|
29
|
-
*/
|
|
30
|
-
compress(batch) {
|
|
31
|
-
const utf8 = new TextEncoder().encode(JSON.stringify(batch.flat()));
|
|
32
|
-
const gzipped = (0, pako_1.gzip)(utf8);
|
|
33
|
-
return btoa(String.fromCharCode(...gzipped));
|
|
34
|
-
}
|
|
35
|
-
get type() {
|
|
36
|
-
return constants_1.RTCMetricsCompressionType.gzip;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.GzipRTCMetricsCompressor = GzipRTCMetricsCompressor;
|
|
40
|
-
//# sourceMappingURL=compressor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compressor.js","sourceRoot":"","sources":["../../../src/sdk/metrics/compressor.ts"],"names":[],"mappings":";;;AACA,2CAAsD;AACtD,+BAA0B;AAgB1B,MAAa,wBAAwB;IAEjC;;;OAGG;IACI,QAAQ,CAAC,KAAsB;QAClC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,qCAAyB,CAAC,IAAI,CAAC;IAC1C,CAAC;CACJ;AAbD,4DAaC;AAED,MAAa,wBAAwB;IAEjC;;;;;;;;;OASG;IACI,QAAQ,CAAC,KAAsB;QAClC,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,qCAAyB,CAAC,IAAI,CAAC;IAC1C,CAAC;CACJ;AArBD,4DAqBC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { InternalMessage } from "../constants";
|
|
2
|
-
/**
|
|
3
|
-
* Prefix used for logging within the metrics collector.
|
|
4
|
-
*/
|
|
5
|
-
export declare const LOG_PREFIX = "stats-collector -";
|
|
6
|
-
/**
|
|
7
|
-
* Supported connection types for metrics transport.
|
|
8
|
-
*/
|
|
9
|
-
export declare const CONNECTION_TYPE: {
|
|
10
|
-
WEBSOCKET: string;
|
|
11
|
-
HTTP: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Maximum allowed number of consecutive send errors
|
|
15
|
-
* before the collector stops sending metrics.
|
|
16
|
-
*/
|
|
17
|
-
export declare const MAX_SEND_ERRORS = 3;
|
|
18
|
-
/**
|
|
19
|
-
* Possible connection states for metrics delivery.
|
|
20
|
-
*/
|
|
21
|
-
export declare const CONNECTION_STATUS: {
|
|
22
|
-
INIT: number;
|
|
23
|
-
OK: number;
|
|
24
|
-
BAD_REQUEST: number;
|
|
25
|
-
INTERNAL_SERVER_ERROR: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Defines whether metrics collection is enabled or disabled.
|
|
29
|
-
*/
|
|
30
|
-
export declare enum RTCMetricsCollect {
|
|
31
|
-
on = "on",
|
|
32
|
-
off = "off"
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Supported compression methods for metrics payloads.
|
|
36
|
-
*/
|
|
37
|
-
export declare enum RTCMetricsCompressionType {
|
|
38
|
-
gzip = "gzip",
|
|
39
|
-
none = "none",
|
|
40
|
-
deflate = "deflate"
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Describes a specific type of metrics available for collection.
|
|
44
|
-
* `metrics` defines the header string.
|
|
45
|
-
* `contains` optionally restricts metrics to those reports whose fields
|
|
46
|
-
* contain specific values.
|
|
47
|
-
*/
|
|
48
|
-
export interface RTCMetricsTypeDescription {
|
|
49
|
-
metrics: string;
|
|
50
|
-
contains?: Record<string, any[]>;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Main configuration object received from the server.
|
|
54
|
-
* This describes how the client should collect and send WebRTC metrics.
|
|
55
|
-
*
|
|
56
|
-
* - `ingestPoint`: HTTP/HTTPS endpoint for POST requests with metrics.
|
|
57
|
-
* - `authorization`: value for the Authorization header for every POST request.
|
|
58
|
-
* - `types`: a map describing metric types and their filtering rules.
|
|
59
|
-
* - `sampling`: sampling period in milliseconds.
|
|
60
|
-
* - `batchSize`: number of samples to collect before sending.
|
|
61
|
-
* - `collect`: enabling or disabling metrics collection.
|
|
62
|
-
* - `compression`: list of allowed compression methods for payloads.
|
|
63
|
-
*/
|
|
64
|
-
export interface RTCMetricsServerDescription {
|
|
65
|
-
types?: Record<string, RTCMetricsTypeDescription>;
|
|
66
|
-
sampling?: number;
|
|
67
|
-
batchSize?: number;
|
|
68
|
-
collect?: RTCMetricsCollect;
|
|
69
|
-
ingestPoint?: string;
|
|
70
|
-
authorization?: string;
|
|
71
|
-
compression?: RTCMetricsCompressionType[];
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* A message describing updates to the metrics configuration.
|
|
75
|
-
*/
|
|
76
|
-
export declare type RTCMetricsDescriptionUpdate = InternalMessage & {
|
|
77
|
-
collect?: RTCMetricsCollect;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Delimiters used for serialization of metrics and headers.
|
|
81
|
-
*/
|
|
82
|
-
export declare enum RTCMetricsDelimiter {
|
|
83
|
-
HEADERS = ",",
|
|
84
|
-
VALUES = ";"
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Describes one metric identifier requested from an RTCStatsReport.
|
|
88
|
-
*
|
|
89
|
-
* - `type`: WebRTC stats type.
|
|
90
|
-
* - `id`: ID of the specific report.
|
|
91
|
-
* - `name`: name of the property within the report.
|
|
92
|
-
*/
|
|
93
|
-
export declare type RTCStatsType = {
|
|
94
|
-
type: string;
|
|
95
|
-
id: string;
|
|
96
|
-
name: string;
|
|
97
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RTCMetricsDelimiter = exports.RTCMetricsCompressionType = exports.RTCMetricsCollect = exports.CONNECTION_STATUS = exports.MAX_SEND_ERRORS = exports.CONNECTION_TYPE = exports.LOG_PREFIX = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Prefix used for logging within the metrics collector.
|
|
6
|
-
*/
|
|
7
|
-
exports.LOG_PREFIX = "stats-collector -";
|
|
8
|
-
/**
|
|
9
|
-
* Supported connection types for metrics transport.
|
|
10
|
-
*/
|
|
11
|
-
exports.CONNECTION_TYPE = {
|
|
12
|
-
WEBSOCKET: "ws",
|
|
13
|
-
HTTP: "http"
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Maximum allowed number of consecutive send errors
|
|
17
|
-
* before the collector stops sending metrics.
|
|
18
|
-
*/
|
|
19
|
-
exports.MAX_SEND_ERRORS = 3;
|
|
20
|
-
/**
|
|
21
|
-
* Possible connection states for metrics delivery.
|
|
22
|
-
*/
|
|
23
|
-
exports.CONNECTION_STATUS = {
|
|
24
|
-
INIT: 0,
|
|
25
|
-
OK: 200,
|
|
26
|
-
BAD_REQUEST: 400,
|
|
27
|
-
INTERNAL_SERVER_ERROR: 500
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Defines whether metrics collection is enabled or disabled.
|
|
31
|
-
*/
|
|
32
|
-
var RTCMetricsCollect;
|
|
33
|
-
(function (RTCMetricsCollect) {
|
|
34
|
-
RTCMetricsCollect["on"] = "on";
|
|
35
|
-
RTCMetricsCollect["off"] = "off";
|
|
36
|
-
})(RTCMetricsCollect = exports.RTCMetricsCollect || (exports.RTCMetricsCollect = {}));
|
|
37
|
-
/**
|
|
38
|
-
* Supported compression methods for metrics payloads.
|
|
39
|
-
*/
|
|
40
|
-
var RTCMetricsCompressionType;
|
|
41
|
-
(function (RTCMetricsCompressionType) {
|
|
42
|
-
RTCMetricsCompressionType["gzip"] = "gzip";
|
|
43
|
-
RTCMetricsCompressionType["none"] = "none";
|
|
44
|
-
RTCMetricsCompressionType["deflate"] = "deflate";
|
|
45
|
-
})(RTCMetricsCompressionType = exports.RTCMetricsCompressionType || (exports.RTCMetricsCompressionType = {}));
|
|
46
|
-
/**
|
|
47
|
-
* Delimiters used for serialization of metrics and headers.
|
|
48
|
-
*/
|
|
49
|
-
var RTCMetricsDelimiter;
|
|
50
|
-
(function (RTCMetricsDelimiter) {
|
|
51
|
-
RTCMetricsDelimiter["HEADERS"] = ",";
|
|
52
|
-
RTCMetricsDelimiter["VALUES"] = ";";
|
|
53
|
-
})(RTCMetricsDelimiter = exports.RTCMetricsDelimiter || (exports.RTCMetricsDelimiter = {}));
|
|
54
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/sdk/metrics/constants.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,UAAU,GAAG,mBAAmB,CAAC;AAE9C;;GAEG;AACU,QAAA,eAAe,GAAG;IAC3B,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,MAAM;CACf,CAAC;AAEF;;;GAGG;AACU,QAAA,eAAe,GAAG,CAAC,CAAC;AAEjC;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC7B,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,GAAG;IACP,WAAW,EAAE,GAAG;IAChB,qBAAqB,EAAE,GAAG;CAC7B,CAAC;AAEF;;GAEG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,8BAAS,CAAA;IACT,gCAAW,CAAA;AACf,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AAED;;GAEG;AACH,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,0CAAa,CAAA;IACb,0CAAa,CAAA;IACb,gDAAmB,CAAA;AACvB,CAAC,EAJW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAIpC;AA0CD;;GAEG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,oCAAa,CAAA;IACb,mCAAY,CAAA;AAChB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface describing a filter for RTC stats reports.
|
|
3
|
-
* Implementations decide whether a given report should pass
|
|
4
|
-
* further processing.
|
|
5
|
-
*/
|
|
6
|
-
export interface IRTCStatsReportFilter {
|
|
7
|
-
/**
|
|
8
|
-
* Determines whether the given stats report should pass the filter.
|
|
9
|
-
*
|
|
10
|
-
* @param report Any RTC stats report object.
|
|
11
|
-
* @returns true if the report is accepted, false otherwise.
|
|
12
|
-
*/
|
|
13
|
-
allowed(report: any): boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Filter that rejects RTP stats reports belonging to inactive tracks.
|
|
17
|
-
* A track is considered inactive if its mediaSourceId is missing,
|
|
18
|
-
* empty, or marked as "(removed)".
|
|
19
|
-
*/
|
|
20
|
-
export declare class InactiveOutboundTrackRTCStatsReportFilter implements IRTCStatsReportFilter {
|
|
21
|
-
/**
|
|
22
|
-
* Checks whether the provided report represents an active RTP track.
|
|
23
|
-
* Only applies to "outbound-rtp" type.
|
|
24
|
-
*
|
|
25
|
-
* @param report RTC stats report.
|
|
26
|
-
* @returns true if the track is active or if the report type is unrelated,
|
|
27
|
-
* false if the track is inactive.
|
|
28
|
-
*/
|
|
29
|
-
allowed(report: any): boolean;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Filter that rejects RTP stats reports belonging to inactive tracks.
|
|
33
|
-
* A track is considered inactive if its framesPerSecond is missing,
|
|
34
|
-
* or marked as "(removed)".
|
|
35
|
-
*/
|
|
36
|
-
export declare class InactiveInboundTrackRTCStatsReportFilter implements IRTCStatsReportFilter {
|
|
37
|
-
/**
|
|
38
|
-
* Checks whether the provided report represents an active RTP track.
|
|
39
|
-
* Only applies to "inbound-rtp" type.
|
|
40
|
-
*
|
|
41
|
-
* @param report RTC stats report.
|
|
42
|
-
* @returns true if the track is active or if the report type is unrelated,
|
|
43
|
-
* false if the track is inactive.
|
|
44
|
-
*/
|
|
45
|
-
allowed(report: any): boolean;
|
|
46
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InactiveInboundTrackRTCStatsReportFilter = exports.InactiveOutboundTrackRTCStatsReportFilter = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Filter that rejects RTP stats reports belonging to inactive tracks.
|
|
6
|
-
* A track is considered inactive if its mediaSourceId is missing,
|
|
7
|
-
* empty, or marked as "(removed)".
|
|
8
|
-
*/
|
|
9
|
-
class InactiveOutboundTrackRTCStatsReportFilter {
|
|
10
|
-
/**
|
|
11
|
-
* Checks whether the provided report represents an active RTP track.
|
|
12
|
-
* Only applies to "outbound-rtp" type.
|
|
13
|
-
*
|
|
14
|
-
* @param report RTC stats report.
|
|
15
|
-
* @returns true if the track is active or if the report type is unrelated,
|
|
16
|
-
* false if the track is inactive.
|
|
17
|
-
*/
|
|
18
|
-
allowed(report) {
|
|
19
|
-
if (report.type === "outbound-rtp") {
|
|
20
|
-
return report.mediaSourceId
|
|
21
|
-
&& report.mediaSourceId !== ""
|
|
22
|
-
&& report.mediaSourceId !== "(removed)";
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.InactiveOutboundTrackRTCStatsReportFilter = InactiveOutboundTrackRTCStatsReportFilter;
|
|
28
|
-
/**
|
|
29
|
-
* Filter that rejects RTP stats reports belonging to inactive tracks.
|
|
30
|
-
* A track is considered inactive if its framesPerSecond is missing,
|
|
31
|
-
* or marked as "(removed)".
|
|
32
|
-
*/
|
|
33
|
-
class InactiveInboundTrackRTCStatsReportFilter {
|
|
34
|
-
/**
|
|
35
|
-
* Checks whether the provided report represents an active RTP track.
|
|
36
|
-
* Only applies to "inbound-rtp" type.
|
|
37
|
-
*
|
|
38
|
-
* @param report RTC stats report.
|
|
39
|
-
* @returns true if the track is active or if the report type is unrelated,
|
|
40
|
-
* false if the track is inactive.
|
|
41
|
-
*/
|
|
42
|
-
allowed(report) {
|
|
43
|
-
if (report.type === "inbound-rtp") {
|
|
44
|
-
return report.framesPerSecond
|
|
45
|
-
&& report.framesPerSecond !== "(removed)";
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.InactiveInboundTrackRTCStatsReportFilter = InactiveInboundTrackRTCStatsReportFilter;
|
|
51
|
-
//# sourceMappingURL=filter.js.map
|