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

Enabling Profiling using environment variable #3670

Closed
ameetpal opened this issue Apr 1, 2024 · 5 comments
Closed

Enabling Profiling using environment variable #3670

ameetpal opened this issue Apr 1, 2024 · 5 comments

Comments

@ameetpal
Copy link
Contributor

ameetpal commented Apr 1, 2024

Feature Description

Currently we are using k6-operator to run tests and how will we able to enable profiling in that ? As of now we are only passing environment variables.

Will it be possible to have a environment variable for enabling profiling ?

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

@ameetpal
Copy link
Contributor Author

Any update here ?

@codebien
Copy link
Contributor

codebien commented Apr 12, 2024

Hey @ameetpal,
yes, it is a good idea to support it as we do for all other options. Unfortunately, I can't guarantee when we will be able to work on it. Probably, the best path for you could be to contribute by opening a pull request.

It should be very similar to the other environment variables in this part of the code.

k6/cmd/state/state.go

Lines 157 to 165 in a5dcc99

func getFlags(defaultFlags GlobalFlags, env map[string]string) GlobalFlags {
result := defaultFlags
// TODO: add env vars for the rest of the values (after adjusting
// rootCmdPersistentFlagSet(), of course)
if val, ok := env["K6_CONFIG"]; ok {
result.ConfigFilePath = val
}

@codebien codebien removed their assignment Apr 12, 2024
@Bablzz
Copy link
Contributor

Bablzz commented Apr 16, 2024

hello everyone! in this case it's just add env variable and set to ProfilingEnabled?

@codebien
Copy link
Contributor

Hey @Bablzz,
yes, very similar to what we already have for

k6/cmd/state/state.go

Lines 163 to 174 in a5dcc99

if val, ok := env["K6_CONFIG"]; ok {
result.ConfigFilePath = val
}
if val, ok := env["K6_LOG_OUTPUT"]; ok {
result.LogOutput = val
}
if val, ok := env["K6_LOG_FORMAT"]; ok {
result.LogFormat = val
}
if env["K6_NO_COLOR"] != "" {
result.NoColor = true
}

Plus, if we are going to add multiple ways for setting it then we have to add a test for the consolidation.

func getConfigConsolidationTestCases() []configConsolidationTestCase {

@mstoykov
Copy link
Contributor

Fixed with #3692

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

4 participants