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

Support custom tags in page.goto() and other relevant methods #4422

Open
5 tasks
mdcruz opened this issue Aug 17, 2022 · 3 comments
Open
5 tasks

Support custom tags in page.goto() and other relevant methods #4422

mdcruz opened this issue Aug 17, 2022 · 3 comments

Comments

@mdcruz
Copy link

mdcruz commented Aug 17, 2022

Currently, we have the ability to support custom tags in k6 core when using http.get() or http.post(). This allows us to customise reports, thresholds or other use cases. See the below code snippet for reference.

http.get('https://test.k6.io/contacts.php', {
    tags: { my_custom_tag: 'contacts' },
  });

This is currently not supported in xk6-browser specific methods such as page.goto(). I have a use case where I want to specify different thresholds per pages and the easiest way is to use tags like the one below:

export const options = {
  ...
  thresholds: {
    'browser_dom_content_loaded{customTag:messages}': ['p(90) < 1000'],
    'browser_dom_content_loaded{customTag:news}': ['p(90) < 800'],
    browser_first_contentful_paint: ['max < 1000']
  }
};

export function messages() {
 /// some other code

  page.goto('https://test.k6.io/my_messages.php', {
    // This custom tag doesn't work as expected
    tags: { customTag: 'messages' },
    waitUntil: 'networkidle'
  })
} 

There are other ways of course to specify different thresholds such as filtering it by default tags such as url or the name metric but it would still be nice to support custom tags going forward.

Resources

Tasks

Preview Give feedback
@fatmaozcelik
Copy link

Hi @imiric, it would be really nice to have such improvement. I also saw that it is confusing and difficult to deal with name metrics etc. Is there any decision made or progress on this issue? Thanks for your answer.

@inancgumus
Copy link
Member

@ankur22 Is this related to grafana/xk6-browser#371 or already done by it?

@ankur22
Copy link
Contributor

ankur22 commented Oct 29, 2024

@inancgumus we need to look into this still. It's unrelated to grafana/xk6-browser#371. It is related to tagging metrics with custom tags. At the moment the browser module will tag metrics here, here and here, whereas with this issue it is wanting to add custom tags when working with our APIs e.g. page.goto. I'm not sure what the outcome of tagging page.goto will be though, will it tag only the page.goto related metrics, or all metrics for the page that it navigates to, or are there other options? We need to investigate and compare with k6's approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants