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

Extra env/tags/exec options for executors #1300

Closed
na-- opened this issue Jan 8, 2020 · 3 comments
Closed

Extra env/tags/exec options for executors #1300

na-- opened this issue Jan 8, 2020 · 3 comments

Comments

@na--
Copy link
Member

na-- commented Jan 8, 2020

Users should be able to inject environment variables and metric tags per-executor, as well as be able to specify a custom function to be executed instead of the default one. Something like this:

export let options = {
    execution: {
        someKey: {
            type: "constant-looping-vus",
            vus: 10,
            duration: "60s",

            // Inject/overwrite environment variable key-value pairs
            env: {
                blah: "whatever",
                key1: "value1",
                key2: "value2"
            },

            // Allow users to execute some other *exported* function besides the default one
            exec: "someExportedFunctionThatsNotTheDefault",

            // The ability to inject additional metric tags
            tags: { tag1: "value1", tag2: "value2" },
        },
    },
}

These things would allow us to relatively gracefully support multiple scenarios in the same script, a very frequently requested feature.

@na--
Copy link
Member Author

na-- commented Jan 8, 2020

My refactoring proposal in #1283 (comment), while apparently not very useful for solving that particular issue as I originally meant it to, still seems to me to be a good way both clean the current overly-complicated code and to implement the features I describe above.

The only missing piece from it is the validation of the exec option - we need to validate that someExportedFunctionThatsNotTheDefault is actually a valid exported function name before we start executing the script... So, probably a new Runner method would be required to get all of the exported function names or something like that.

@imiric imiric self-assigned this Apr 8, 2020
imiric pushed a commit to imiric/k6 that referenced this issue Apr 17, 2020
imiric pushed a commit to imiric/k6 that referenced this issue Apr 20, 2020
imiric pushed a commit to imiric/k6 that referenced this issue Apr 21, 2020
imiric pushed a commit to imiric/k6 that referenced this issue Apr 21, 2020
@imiric
Copy link
Contributor

imiric commented Apr 21, 2020

This should technically be done (see my feat/1007-1300-env-tags-exec-options branch), but I'll hold off on creating a PR for it until after fix/1007-1283-context-cancelled (#1368) is merged, since it's based on it.

@na--
Copy link
Member Author

na-- commented May 18, 2020

Closed by #1428

@na-- na-- closed this as completed May 18, 2020
imiric pushed a commit that referenced this issue Jun 29, 2020
This tags all metrics emitted in the main "exec" function with a "scenario" tag
set to the scenario name or "default" if no custom scenarios were defined.
It can be disabled with the `--system-tags` option.

There's no issue for this specific feature, but see #796 and #1300.
imiric pushed a commit that referenced this issue Jun 30, 2020
This tags all metrics emitted in the main "exec" function with a "scenario" tag
set to the scenario name or "default" if no custom scenarios were defined.
It can be disabled with the `--system-tags` option.

There's no issue for this specific feature, but see #796 and #1300.
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

2 participants