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
Refactor isRemoteBrowser check #889
Merged
Merged
Conversation
This file contains 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
inancgumus
reviewed
May 17, 2023
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.
We're renaming them from webvital_xxx_xxx_xxx to browser_web_vital_xxx. This change benefits us in three ways: 1. Browser metrics will be namespaced with browser_ 2. webvital is two words, so web vital 3. We're assuming that users will have the context of web vital metrics so that we can use the abbreviations which also helps with the display of them at the end of the test run. Closes: #884
ankur22
force-pushed
the
refactor/remote-global-check
branch
from
May 18, 2023 11:01
63196d0
to
b64e8b1
Compare
This type will use env to retrieve the remote ws url details and whether one is supplied. It will store this data, which can then be retrieved when needed.
Create a new instance of remoteRegistry which can be stored in the RootModule. This single instance of remoteRegistry can be set in all new ModuleInstances. Later on anything requiring the remoteRegistry should be able to access it to retrieve the remote ws url.
ankur22
force-pushed
the
refactor/remote-global-check
branch
from
May 18, 2023 11:06
b64e8b1
to
2980e0d
Compare
Now that the remoteRegistry is part of the ModuleInstance, we can retrieve the parsed data from the env var and use it when setting up the mapping for the current vu.
ankur22
force-pushed
the
refactor/remote-global-check
branch
from
May 18, 2023 11:08
2980e0d
to
b3b101f
Compare
ankur22
commented
May 18, 2023
ka3de
reviewed
May 22, 2023
When K6_BROWSER_WS_URL is a comma separated list of ws urls, we need to pick from the list every time remoteRegistry.IsRemoteBrowser is called, not just once when remoteRegistry is created. This change moves the round robin (with the use of rand) to remoteRegistry.Is... ...RemoteBrowser from env.IsRemoteBrowser. env.IsRemoteBrowser now only collects and returns the list of ws urls.
ankur22
force-pushed
the
refactor/remote-global-check
branch
from
May 22, 2023 10:05
dd7a025
to
a81d246
Compare
Env package now contains one type that is specific to the environment. The registry package contains changes which are specific to retrieving the remote ws urls. So this commit splits the two different concerns. A future commit with also move the remote registry specific logic from the browser package into the registry package.
To encapsulate the remote registry logic, we've moved the remote registry logic from the browser package into the remote package.
We no longer need to expose the pkg scoped IsRemoteBrowser since the only thing calling it is NewRemoteRegistry. The logic has been moved into NewRemoteRegistry.
inancgumus
approved these changes
May 22, 2023
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.
Nice 👏
ka3de
reviewed
May 22, 2023
ka3de
reviewed
May 22, 2023
ankur22
added a commit
that referenced
this pull request
May 22, 2023
ankur22
force-pushed
the
refactor/remote-global-check
branch
from
May 22, 2023 15:10
6fc9b9f
to
6d87e37
Compare
Merged
ka3de
approved these changes
May 23, 2023
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.
LGTM 👏
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes
This refactors the
IsRemoteBrowser
detection of the code so that it is done once when creating theRootModule
. We now rely on aremoteRegistry
which can be accessed by the mapping when a new vu is initialised. Eventually when there are multiple remote chrome instances, this will select one of many ws urls and return it for use in the current vu/iteration.