Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
balazskreith committed Apr 9, 2024
1 parent ef424e5 commit 68542a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observertc/observer-js",
"version": "0.40.19",
"version": "0.40.20",
"description": "Server Side NodeJS Library for processing ObserveRTC Samples",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/ObservedClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
public readonly mediaDevices: string[] = [];
public readonly codecs: string[] = [];
public readonly userMediaErrors: string[] = [];
public readonly issues: ClientIssue[] = [];

public readonly ωpendingCreatedTracksTimestamp = new Map<string, number>();
public readonly ωpendingCreatedPeerConnectionTimestamp = new Map<string, number>();
Expand Down Expand Up @@ -235,6 +236,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
logger.warn(`Error adding client issue: ${(err as Error)?.message}`);
}

this.issues.push(issue);
this.emit('issue', issue);
}

Expand Down Expand Up @@ -433,6 +435,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
attachments: callEvent.attachments ? JSON.parse(callEvent.attachments) : undefined,
};

this.issues.push(issue);
this.emit('issue', issue);
} catch (err) {
logger.warn(`Error parsing client issue: ${(err as Error)?.message}`);
Expand Down
14 changes: 4 additions & 10 deletions src/monitors/CallSummaryMonitor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventEmitter } from 'events';
import { CallSummary, ClientIssue, ClientSummary } from './CallSummary';
import { CallSummary, ClientSummary } from './CallSummary';
import { ObservedCall } from '../ObservedCall';
import { ObservedClient } from '../ObservedClient';
import { ObservedOutboundTrack } from '../ObservedOutboundTrack';
Expand Down Expand Up @@ -93,12 +93,6 @@ export class CallSummaryMonitor extends EventEmitter {
clientSummary.usedTurn ||= usingTurn;
};

const onIssue = (issue: ClientIssue) => {
++callSummary.numberOfIssues;
clientSummary.issues.push(issue);

};

const onUserMediaError = (error: string) => {
if (!this.config.detectUserMediaIssues) return;

Expand All @@ -113,7 +107,6 @@ export class CallSummaryMonitor extends EventEmitter {

client.on('update', updateClient);
client.on('usingturn', onUsingTurn);
client.on('issue', onIssue);
client.on('usermediaerror', onUserMediaError);
client.on('newpeerconnection', onNewPeerConnection);
client.once('close', () => {
Expand All @@ -127,14 +120,15 @@ export class CallSummaryMonitor extends EventEmitter {
clientSummary.totalDataChannelBytesReceived = client.totalDataChannelBytesReceived;
clientSummary.durationInMs = now - client.created;
clientSummary.left = now;

clientSummary.issues.push(...client.issues);

client.off('update', updateClient);
client.off('usingturn', onUsingTurn);
client.off('issue', onIssue);
client.off('usermediaerror', onUserMediaError);
client.off('newpeerconnection', onNewPeerConnection);

callSummary.durationInMs += clientSummary.durationInMs;
callSummary.numberOfIssues += clientSummary.issues.length;
});
}

Expand Down

0 comments on commit 68542a6

Please sign in to comment.