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

Enable K6 by default in agent deployments #722

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Enable K6 by default in agent deployments #722

merged 2 commits into from
Jun 10, 2024

Conversation

The-9880
Copy link
Contributor

@The-9880 The-9880 commented Jun 6, 2024

Resolves #721
Decision (Slack)

Summary:

  • Removes --features from the cmd, adds an explicit --disable-k6 to disable the runner + k6 checks.
  • Updates the error message for k6 capability missing on probe.

Users upgrading from older probes (will) have k6 scripts disabled by default in the API if they weren't already running k6 checks. There are 2 cases for them:

  1. Had k6 FF in args: no impact, this setup makes it default-enabled.
  2. Did not have k6 FF: this was the default. If they use the Docker image or have k6 on their PATH, then their upgraded agent would be able to set up a k6Runner. Any previously-assigned MultiHTTP or scripted checks may start running. They will need to enable in the UI to assign k6 checks.

For new probes, this change aligns the agent's default with the default assumption of the UI/Terraform (k6-enabled), so it should reduce issues with setup.

Also updated the error message when k6 is missing - feedback appreciated.

@@ -53,7 +53,7 @@ func (e FatalError) Error() string { return string(e) }
var _ error = FatalError("")

const (
errCapabilityK6Missing = FatalError("k6 is required for scripted check support")
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or edit probe capabilities in the SM app")
Copy link
Contributor Author

@The-9880 The-9880 Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or edit probe capabilities in the SM app")
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or disable the probe's k6 capability in the SM app")

Thoughts on this rewording? I can't find a good, succinct way to describe this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What comes to my mind is

Suggested change
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or edit probe capabilities in the SM app")
errCapabilityK6Missing = FatalError("synthetic monitoring backend requested k6 to be enabled on this probe, but it is disabled by CLI arg")

@The-9880 The-9880 marked this pull request as ready for review June 7, 2024 14:19
@The-9880 The-9880 requested a review from a team as a code owner June 7, 2024 14:19
@@ -53,7 +53,7 @@ func (e FatalError) Error() string { return string(e) }
var _ error = FatalError("")

const (
errCapabilityK6Missing = FatalError("k6 is required for scripted check support")
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or edit probe capabilities in the SM app")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What comes to my mind is

Suggested change
errCapabilityK6Missing = FatalError("k6 is required for scripted check support - configure k6 or edit probe capabilities in the SM app")
errCapabilityK6Missing = FatalError("synthetic monitoring backend requested k6 to be enabled on this probe, but it is disabled by CLI arg")

Comment on lines +136 to +140
if !config.DisableK6 {
if err := features.Set(feature.K6); err != nil {
return fmt.Errorf("cannot set k6 feature: %w", err)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not fully clear to me how the new flag (--disable-k6) and the old one (--features=k6) interact.

I think it makes sense having a dedicated K6 flag for disabling k6, but that makes me wonder if we should get rid of, or deprecate the feature flag.

Copy link
Contributor Author

@The-9880 The-9880 Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does get rid of the --features flag on L105-106. I could "formally" deprecate it by detecting it and printing out a message.


How the new vs old flags interact
features is a collection object which holds active features enabled on this probe. It used to have traceroute and adhoc when those were FFs, but now only k6 remains as functionality that can be disabled.

The old flag --features was captured by flags.Var, which implicitly called features.Set on the arg value. features.Set assumes a csv input and splits it to save each element.

Example: features.Set("traceroute,k6,adhoc") -> map[string]struct{}{"traceroute": struct{}, "k6": struct{}, "adhoc": struct{}}.

With this change, --features is gone. We explicitly call features.Set("k6") unless --disable-k6 is set, making k6 a default-enabled feature on the probe.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're definitely right, I did not see the removal of the --features CLI flag 🙈
Looking good :)

@The-9880 The-9880 merged commit 123b0d6 into main Jun 10, 2024
4 checks passed
@The-9880 The-9880 deleted the default-k6 branch June 10, 2024 13:39
The-9880 added a commit that referenced this pull request Jun 10, 2024
* Chore(deps): Bump golang.org/x/net from 0.24.0 to 0.25.0
* Chore(deps): Bump the prometheus-go group across 1 directory with 2 updates
* Chore(deps): Bump github.com/mccutchen/go-httpbin/v2
* Update to grafana-build-tools v0.11.0 (#705)
* Remove adhoc and traceroute feature flags. (#707)
* Chore(deps): Bump github.com/KimMachineGun/automemlimit
* checks/test: make timer big enough for context cancel to be picked up
* Fix: Interpolate variables into MultiHTTP request bodies (#713)
* Chore(deps): Bump github.com/prometheus/prometheus (#716)
* Chore(deps): Bump github.com/rs/zerolog from 1.32.0 to 1.33.0
* --- updated-dependencies: - dependency-name: kernel.org/pub/linux/libs/security/libcap/cap   dependency-type: direct:production   update-type: version-update:semver-patch ...
* MultiHttp script should decode the payload as a string and replace the variable placeholders with the values. The result should be assigned to the request body. (#717)
* Build(deps): Bump golang.org/x/net from 0.25.0 to 0.26.0
* Enable K6 by default in agent deployments (#722)

Signed-off-by: Anant Sharma <anant.sharma@grafana.com>
@The-9880 The-9880 mentioned this pull request Jun 10, 2024
The-9880 added a commit that referenced this pull request Jun 11, 2024
* Chore(deps): Bump golang.org/x/net from 0.24.0 to 0.25.0
* Chore(deps): Bump the prometheus-go group across 1 directory with 2 updates
* Chore(deps): Bump github.com/mccutchen/go-httpbin/v2
* Update to grafana-build-tools v0.11.0 (#705)
* Remove adhoc and traceroute feature flags. (#707)
* Chore(deps): Bump github.com/KimMachineGun/automemlimit
* checks/test: make timer big enough for context cancel to be picked up
* Fix: Interpolate variables into MultiHTTP request bodies (#713)
* Chore(deps): Bump github.com/prometheus/prometheus (#716)
* Chore(deps): Bump github.com/rs/zerolog from 1.32.0 to 1.33.0
* --- updated-dependencies: - dependency-name: kernel.org/pub/linux/libs/security/libcap/cap   dependency-type: direct:production   update-type: version-update:semver-patch ...
* MultiHttp script should decode the payload as a string and replace the variable placeholders with the values. The result should be assigned to the request body. (#717)
* Build(deps): Bump golang.org/x/net from 0.25.0 to 0.26.0
* Enable K6 by default in agent deployments (#722)
* Fix: deprecate --features and warn user (#726)
* k6runner: use check context for http request (#715)

Signed-off-by: Anant Sharma <anant.sharma@grafana.com>
@The-9880 The-9880 mentioned this pull request Jun 11, 2024
The-9880 added a commit that referenced this pull request Jun 13, 2024
* Chore(deps): Bump golang.org/x/net from 0.24.0 to 0.25.0
* Chore(deps): Bump the prometheus-go group across 1 directory with 2 updates
* Chore(deps): Bump github.com/mccutchen/go-httpbin/v2
* Update to grafana-build-tools v0.11.0 (#705)
* Remove adhoc and traceroute feature flags. (#707)
* Chore(deps): Bump github.com/KimMachineGun/automemlimit
* checks/test: make timer big enough for context cancel to be picked up
* Fix: Interpolate variables into MultiHTTP request bodies (#713)
* Chore(deps): Bump github.com/prometheus/prometheus (#716)
* Chore(deps): Bump github.com/rs/zerolog from 1.32.0 to 1.33.0
* --- updated-dependencies: - dependency-name: kernel.org/pub/linux/libs/security/libcap/cap   dependency-type: direct:production   update-type: version-update:semver-patch ...
* MultiHttp script should decode the payload as a string and replace the variable placeholders with the values. The result should be assigned to the request body. (#717)
* Build(deps): Bump golang.org/x/net from 0.25.0 to 0.26.0
* Enable K6 by default in agent deployments (#722)
* Fix: deprecate --features and warn user (#726)
* k6runner: use check context for http request (#715)

Signed-off-by: Anant Sharma <anant.sharma@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default-enable K6 + update missing k6 error message
2 participants