-
Notifications
You must be signed in to change notification settings - Fork 344
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
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ export default class RtcMetrics { | |
|
||
connectionId: string; | ||
|
||
shouldSendMetricsOnNextStatsReport: boolean; | ||
shouldSendMetricsOnNextStatsReport: number; | ||
|
||
/** | ||
* Initialize the interval. | ||
|
@@ -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; | ||
} | ||
|
||
/** | ||
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe worth changing the condition in line 95 to |
||
} | ||
|
||
try { | ||
|
@@ -151,7 +152,7 @@ export default class RtcMetrics { | |
*/ | ||
private resetConnection() { | ||
this.connectionId = uuid.v4(); | ||
this.shouldSendMetricsOnNextStatsReport = true; | ||
this.shouldSendMetricsOnNextStatsReport = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
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)