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

Expose HasModuleInstancePerVU interface to external consumers #1909

Closed
simskij opened this issue Mar 16, 2021 · 1 comment
Closed

Expose HasModuleInstancePerVU interface to external consumers #1909

simskij opened this issue Mar 16, 2021 · 1 comment
Labels
enhancement medium prio xk6 issues related to how k6 supports building extensions using xk6

Comments

@simskij
Copy link
Contributor

simskij commented Mar 16, 2021

Expose HasModuleInstancePerVU to external consumers.

Feature Description

Currently, the HasModuleInstancePerVU interface is placed in an internal folder. This has the drawback that you can't check explicitly that an xk6 module implements it using the famous old var _ module.HasModuleInstancePerVU = new(Whatever) method. This might lead to extensions drifting away from the interface over time, without noticing, as this will only be checked at runtime.

https://github.com/loadimpact/k6/blob/67e33ab75d6a94659792ecf31afa7dd69e87c825/js/internal/modules/modules.go#L45-L50

Suggested Solution (optional)

While it is possible to redefine the interface in your xk6 package, or just skip the check and implement NewModuleInstancePerVU() anyway, it makes the xk6 extension unnecessarily fragile. Instead, I suggest we expose it by moving it outside the internal folder.

@simskij simskij added enhancement medium prio xk6 issues related to how k6 supports building extensions using xk6 labels Mar 16, 2021
@na--
Copy link
Member

na-- commented Mar 16, 2021

It is still in internal because we don't have a firm agreement on how per-VU module instances should work. Please read through #1858 and comment if you have an opinion on the topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement medium prio xk6 issues related to how k6 supports building extensions using xk6
Projects
None yet
Development

No branches or pull requests

2 participants