Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send rtc metrics at the beginning every 5 seconds #3893

Draft
wants to merge 1 commit into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/@webex/plugin-meetings/src/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3213,7 +3213,8 @@ export default class Meeting extends StatelessWebexPlugin {
options: {meetingId: this.id},
});
}
this.rtcMetrics?.sendNextMetrics();
const numberOfReportsToSend = 30000 / 5000; // 30 seconds divided by 5 seconds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's really annoying that the constant for calling getStats every 5s is buried deep in WCME and not even exported from it, but at least the 30s timer for uploading is defined in rtcMetrics/index.ts in SDK so we could define a constant and use it here instead of hardcoding 30000. Maybe define a constant for the 5s inside rtcMetrics/index.ts too so that both are kept together? Or don't bother with the math and just set numberOfReportsToSend=5 or 6, after all we just want "a few" reports with data from initial meeting phase, don't care about the exact number of seconds the data is from. If you go with that, then maybe define a constant so the same value is used also when we don't go through lobby (see my other comment)

this.rtcMetrics?.sendNextMetrics(numberOfReportsToSend);
this.updateLLMConnection();
});

Expand Down
11 changes: 6 additions & 5 deletions packages/@webex/plugin-meetings/src/rtcMetrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class RtcMetrics {

connectionId: string;

shouldSendMetricsOnNextStatsReport: boolean;
shouldSendMetricsOnNextStatsReport: number;

/**
* Initialize the interval.
Expand Down Expand Up @@ -70,10 +70,11 @@ export default class RtcMetrics {
* This is useful for cases when something important happens that affects the media connection,
* for example when we move from lobby into the meeting.
*
* @param {number} n - The number of next N metrics reports to send.
* @returns {void}
*/
public sendNextMetrics() {
this.shouldSendMetricsOnNextStatsReport = true;
public sendNextMetrics(n = 1) {
this.shouldSendMetricsOnNextStatsReport = n;
}

/**
Expand All @@ -95,7 +96,7 @@ export default class RtcMetrics {
// this is the first useful set of data (WCME gives it to us after 5s), send it out immediately
// in case the user is unhappy and closes the browser early
this.sendMetricsInQueue();
this.shouldSendMetricsOnNextStatsReport = false;
this.shouldSendMetricsOnNextStatsReport -= 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth changing the condition in line 95 to this.shouldSendMetricsOnNextStatsReport > 0 just in case if that variable ever became negative somehow?

}

try {
Expand Down Expand Up @@ -151,7 +152,7 @@ export default class RtcMetrics {
*/
private resetConnection() {
this.connectionId = uuid.v4();
this.shouldSendMetricsOnNextStatsReport = true;
this.shouldSendMetricsOnNextStatsReport = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should set this to 30000/5000 here too, right? This is called from constructor so this is the default used when we join the meeting straight in, without lobby.

}

/**
Expand Down
Loading