-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Deprecate experimental/redis module #5237
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
Open
codebien
wants to merge
3
commits into
master
Choose a base branch
from
redis-as-extension
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−1
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package js | |
|
|
||
| import ( | ||
| "errors" | ||
| "sync" | ||
|
|
||
| "go.k6.io/k6/ext" | ||
| "go.k6.io/k6/internal/js/modules/k6" | ||
|
|
@@ -49,10 +50,15 @@ func getInternalJSModules() map[string]interface{} { | |
| // Experimental modules | ||
| "k6/experimental/csv": csv.New(), | ||
| "k6/experimental/fs": fs.New(), | ||
| "k6/experimental/redis": redis.New(), | ||
| "k6/experimental/streams": streams.New(), | ||
| "k6/experimental/websockets": expws.New(), | ||
|
|
||
| // Deprecated modules | ||
| "k6/experimental/redis": newWarnExperimentalModule(redis.New(), | ||
| "k6/experimental/redis has been deprecated and will be removed in future versions."+ | ||
| " Please migrate to the new version by changing your import to 'k6/x/redis'."+ | ||
| " Read more here: https://grafana.com/docs/k6/latest/javascript-api/k6-x/redis"), | ||
|
|
||
| // Removed modules | ||
| "k6/experimental/browser": newRemovedModule( | ||
| "k6/experimental/browser has been graduated, please use k6/browser instead." + | ||
|
|
@@ -101,3 +107,22 @@ func (rm *removedModule) NewModuleInstance(vu modules.VU) modules.Instance { | |
|
|
||
| return nil | ||
| } | ||
|
|
||
| type warnExperimentalModule struct { | ||
| once sync.Once | ||
| msg string | ||
| base modules.Module | ||
| } | ||
|
|
||
| func newWarnExperimentalModule(base modules.Module, msg string) modules.Module { | ||
| return &warnExperimentalModule{ | ||
| msg: msg, | ||
| base: base, | ||
| once: sync.Once{}, | ||
|
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. We can remove this now (line 121) 🎉 |
||
| } | ||
| } | ||
|
|
||
| func (w *warnExperimentalModule) NewModuleInstance(vu modules.VU) modules.Instance { | ||
| w.once.Do(func() { vu.InitEnv().Logger.Warn(w.msg) }) | ||
| return w.base.NewModuleInstance(vu) | ||
| } | ||
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.
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.
This is an invented path. For now, we aren't hosting any documentation of official extensions on grafana.com/docs. I guess we don't want to drop the documentation for redis from the official docs so we need to find a new home for it.
The current experiemental documentation is here https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/redis/
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.
This aligns with the approach I took with the dns extension's docs so far.
In xk6-dns, I used:
docs/sources/k6/next/javascript-api/k6-x-dns/_index.mdas a format, because my preferred approach was to treat extensions as first class citizens in the docs. Not distinguish them from modules. Simply adding a common "admonition" (I think that's how they're called, at the top mentioning that the following module is an extension (as users need to know, but it concretely doesn't change much to their usage in practice).I wouldn't mind putting it in a separate folder like you're doing here though.