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

appsec: add tracer start option for appsec enablement #2966

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

RomainMuller
Copy link
Contributor

What does this PR do?

Adds a new tracer start option that allows to explicitly enable or disable appsec, overriding the default activation criteria (from DD_APPSEC_ENABLED and remote configuration).

Motivation

There is a use-case in https://github.com/DataDog/datadog-agent where a tracer is started but AppSec features are undesirable (and unsupported) in this context. Explicitly disabling AppSec features allows to avoid emitting an AppSec startup error message when the agent's environment includes DD_APPSEC_ENABLED=true.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

Adds a new tracer start option that allows to explicitly enable or
disable appsec, overriding the default activation criteria (from
`DD_APPSEC_ENABLED` and remote configuration).
@RomainMuller RomainMuller requested review from a team as code owners November 6, 2024 14:27
@@ -660,7 +664,7 @@ func loadAgentFeatures(agentDisabled bool, agentURL *url.URL, httpClient *http.C
}
defer resp.Body.Close()
type agentConfig struct {
defaultEnv string `json:"default_env"`
DefaultEnv string `json:"default_env"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NB - This was previously broken; as the json package cannot do anything with non-exported fields...

Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

Copy link
Contributor

@eliottness eliottness left a comment

Choose a reason for hiding this comment

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

LGTM

@pr-commenter
Copy link

pr-commenter bot commented Nov 6, 2024

Benchmarks

Benchmark execution time: 2024-11-06 17:42:14

Comparing candidate commit 855a63d in PR branch romain.marcadier/tracer-appsec-option with baseline commit 5dd43b0 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 0 unstable metrics.

@@ -660,7 +664,7 @@ func loadAgentFeatures(agentDisabled bool, agentURL *url.URL, httpClient *http.C
}
defer resp.Body.Close()
type agentConfig struct {
defaultEnv string `json:"default_env"`
DefaultEnv string `json:"default_env"`
Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

@RomainMuller RomainMuller enabled auto-merge (squash) November 6, 2024 17:01
@RomainMuller RomainMuller merged commit d2882eb into main Nov 6, 2024
171 checks passed
@RomainMuller RomainMuller deleted the romain.marcadier/tracer-appsec-option branch November 6, 2024 23:11
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.

4 participants