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

Merge browser in k6 #4056

Merged
merged 3,097 commits into from
Dec 13, 2024
Merged

Merge browser in k6 #4056

merged 3,097 commits into from
Dec 13, 2024

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Nov 13, 2024

What?

Move xk6-browser inside k6 codebase

Why?

Browser is no longer experimental and it makes more sense to have a single repository

List of commands I've ran:

  1. git subtree add -P js/modules/k6/browser git@github.com:grafana/xk6-browser.git main - requires git-subtree - in practice can be done with a bunch of additional commands, just this is faser and easier
  2. cd js/modules/k6/browser/
  3. git rm -r CODE_OF_CONDUCT.md CODEOWNERS CONTRIBUTING.md docker-compose.yaml Dockerfile go.mod go.sum LICENSE Makefile README.md register.go SECURITY.md SUPPORT.md sync_register.go TROUBLESHOOTING.md release\ notes/ assets .golangci.yml .gitignore .github/
  4. git commit -m "browser: cleanup unnsecessary files" -n
  5. find . -iname '*.go' | xargs sed -i -r 's|github.com/grafana/xk6-browser|go.k6.io/k6/js/modules/k6/browser|g'
  6. edit js/jsmodules.go to import the new import
  7. go mod tidy && go mod vendor
  8. git commit -m "Move to using the in k6 browser code"
  9. Update .golangci.yml to disable revive and contextcheck and git commit it
  10. git mv js/modules/k6/browser/examples/ examples/browser && git rm examples/browser.js examples/experimental/browser.js && git commit -m "Move browser examples and clean old ones" -a
  11. cd examples/browser/ && sed -i -r 's!/x/browser/async!/browser!g' * && git commit -m "Fix imports in browser examples"
  12. cd ../../js/modules/k6/browser && git rm -r sync-examples/ && git commit -m "browser: remove sync examples"
  13. Copy an updates e2e.yml from the browser repo to make the browser examples execute

TODO:

  • general workflow on how this PR will be made
  • moving examples
  • running example tests
  • fix lint issues

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

ankur22 and others added 30 commits October 7, 2024 21:17
This function will call the handlers one by one, allowing each handler
to check the url matches and return the name. Each handler will
overwrite the name if multiple handlers match with the given url. This
function needs to wait for the handler to complete before proceeding to
the next handler.
Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
This makes working with an atomic int more maintainable.
Instead of working with goroutines and channels to propagate the name
back from GroupURLTag, a name field is updated in ExportedMetric. The
call to the taskqueue is synchronised so when the handler is called we
can safely wait for it to complete instead of relying on channels and
contexts to wait for it to complete.
This better represents what is happening. When a match is found, the
metric is tagged. It is not grouping anything, the grouping is a wanted
side effect.
We're now only creating a single MetricEvent for all handlers.
@mstoykov mstoykov added this to the v0.56.0 milestone Dec 12, 2024
Copy link
Contributor

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

Great work! 🚀 🚀 🚀

@mstoykov mstoykov merged commit 745f0d4 into master Dec 13, 2024
26 of 29 checks passed
@mstoykov mstoykov deleted the mergeBrowserInK6 branch December 13, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants