-
Notifications
You must be signed in to change notification settings - Fork 386
fix(plugin-meetings): metrics on reachability subnet #4234
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
Merged
k-wasniowski
merged 16 commits into
webex:next
from
k-wasniowski:feat-metrics-on-reachability-subnet
May 12, 2025
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
296c10a
feat: metrics on reachability subnet
k-wasniowski 434ba74
fix: make calculation out of all clusters
k-wasniowski 4494d1b
fix: unit tests
k-wasniowski 29d89f0
Merge branch 'next' into feat-metrics-on-reachability-subnet
k-wasniowski 11bd791
fix: wait for gathering end
k-wasniowski 766cd8f
fix: correct some UT
k-wasniowski 677942e
Merge branch 'next' into feat-metrics-on-reachability-subnet
k-wasniowski 779acf2
fix: improvements
k-wasniowski 23beb8e
Merge branch 'next' into feat-metrics-on-reachability-subnet
k-wasniowski 415d7b6
fix: should be null if media server ip is not provided
k-wasniowski 20824be
Merge branch 'next' into feat-metrics-on-reachability-subnet
k-wasniowski 1d7d77a
Merge branch 'next' into feat-metrics-on-reachability-subnet
k-wasniowski b23e20b
Update packages/@webex/plugin-meetings/src/meeting/index.ts
k-wasniowski 3d41420
fix: corrections to UT
k-wasniowski c2f033c
fix: some more tests changes
k-wasniowski 878d8a1
fix: missing resolve for symmetric-nat test
k-wasniowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,6 +49,7 @@ export class ClusterReachability extends EventsScope { | |||||||||||||||||||||||
| private srflxIceCandidates: RTCIceCandidate[] = []; | ||||||||||||||||||||||||
| public readonly isVideoMesh: boolean; | ||||||||||||||||||||||||
| public readonly name; | ||||||||||||||||||||||||
| public readonly reachedSubnets: Set<string> = new Set(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Constructor for ClusterReachability | ||||||||||||||||||||||||
|
|
@@ -234,27 +235,13 @@ export class ClusterReachability extends EventsScope { | |||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| private registerIceGatheringStateChangeListener() { | ||||||||||||||||||||||||
| this.pc.onicegatheringstatechange = () => { | ||||||||||||||||||||||||
| const {COMPLETE} = ICE_GATHERING_STATE; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (this.pc.iceConnectionState === COMPLETE) { | ||||||||||||||||||||||||
k-wasniowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| if (this.pc.iceGatheringState === ICE_GATHERING_STATE.COMPLETE) { | ||||||||||||||||||||||||
| this.closePeerConnection(); | ||||||||||||||||||||||||
| this.finishReachabilityCheck(); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Checks if we have the results for all the protocols (UDP and TCP) | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * @returns {boolean} true if we have all results, false otherwise | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| private haveWeGotAllResults(): boolean { | ||||||||||||||||||||||||
| return ['udp', 'tcp', 'xtls'].every( | ||||||||||||||||||||||||
| (protocol) => | ||||||||||||||||||||||||
| this.result[protocol].result === 'reachable' || this.result[protocol].result === 'untested' | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
| * Saves the latency in the result for the given protocol and marks it as reachable, | ||||||||||||||||||||||||
| * emits the "resultReady" event if this is the first result for that protocol, | ||||||||||||||||||||||||
|
|
@@ -264,9 +251,15 @@ export class ClusterReachability extends EventsScope { | |||||||||||||||||||||||
| * @param {string} protocol | ||||||||||||||||||||||||
| * @param {number} latency | ||||||||||||||||||||||||
| * @param {string|null} [publicIp] | ||||||||||||||||||||||||
| * @param {string|null} [serverIp] | ||||||||||||||||||||||||
| * @returns {void} | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| private saveResult(protocol: 'udp' | 'tcp' | 'xtls', latency: number, publicIp?: string | null) { | ||||||||||||||||||||||||
| private saveResult( | ||||||||||||||||||||||||
| protocol: 'udp' | 'tcp' | 'xtls', | ||||||||||||||||||||||||
| latency: number, | ||||||||||||||||||||||||
| publicIp?: string | null, | ||||||||||||||||||||||||
| serverIp?: string | null | ||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||
| const result = this.result[protocol]; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (result.latencyInMilliseconds === undefined) { | ||||||||||||||||||||||||
|
|
@@ -294,6 +287,10 @@ export class ClusterReachability extends EventsScope { | |||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
| this.addPublicIP(protocol, publicIp); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (serverIp) { | ||||||||||||||||||||||||
| this.reachedSubnets.add(serverIp); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||
|
|
@@ -351,21 +348,25 @@ export class ClusterReachability extends EventsScope { | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (e.candidate) { | ||||||||||||||||||||||||
| if (e.candidate.type === CANDIDATE_TYPES.SERVER_REFLEXIVE) { | ||||||||||||||||||||||||
| this.saveResult('udp', latencyInMilliseconds, e.candidate.address); | ||||||||||||||||||||||||
| let serverIp = null; | ||||||||||||||||||||||||
| if ('url' in e.candidate) { | ||||||||||||||||||||||||
k-wasniowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| const stunServerUrlRegex = /stun:([\d.]+):\d+/; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const match = (e.candidate as any).url.match(stunServerUrlRegex); | ||||||||||||||||||||||||
| if (match) { | ||||||||||||||||||||||||
| // eslint-disable-next-line prefer-destructuring | ||||||||||||||||||||||||
| serverIp = match[1]; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| this.saveResult('udp', latencyInMilliseconds, e.candidate.address, serverIp); | ||||||||||||||||||||||||
|
Comment on lines
+356
to
+362
Contributor
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. Suggestion: use ternary operator
Suggested change
Contributor
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. I'm not sure if this line is good readable.. |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| this.determineNatType(e.candidate); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (e.candidate.type === CANDIDATE_TYPES.RELAY) { | ||||||||||||||||||||||||
| const protocol = e.candidate.port === TURN_TLS_PORT ? 'xtls' : 'tcp'; | ||||||||||||||||||||||||
| this.saveResult(protocol, latencyInMilliseconds); | ||||||||||||||||||||||||
| // we don't add public IP for TCP, because in the case of relay candidates | ||||||||||||||||||||||||
| // e.candidate.address is the TURN server address, not the client's public IP | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (this.haveWeGotAllResults()) { | ||||||||||||||||||||||||
| this.closePeerConnection(); | ||||||||||||||||||||||||
| this.finishReachabilityCheck(); | ||||||||||||||||||||||||
| this.saveResult(protocol, latencyInMilliseconds, null, e.candidate.address); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.