-
Notifications
You must be signed in to change notification settings - Fork 536
feat(config): introduce the global DD_AGENTLESS_ENABLED flag #19631
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
Draft
bwoebi
wants to merge
1
commit into
main
Choose a base branch
from
bob/agentless-setting
base: main
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.
Draft
Changes from all commits
Commits
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
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
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
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import typing as t | ||
|
|
||
| from ddtrace.internal.settings._core import DDConfig | ||
|
|
||
|
|
||
| class AgentlessConfig(DDConfig): | ||
| # No __prefix__: _DD_APM_TRACING_AGENTLESS_ENABLED start with _. | ||
|
|
||
| api_key = DDConfig.v(t.Optional[str], "dd.api_key", default=None) | ||
| site = DDConfig.v(str, "dd.site", default="datadoghq.com") | ||
|
|
||
| #: The global switch. Every product setting below defaults to it. | ||
| enabled = DDConfig.v(bool, "dd.agentless.enabled", default=False) | ||
|
|
||
| # Raw per-product overrides; None means "follow the global switch". Read the | ||
| # resolved values below instead of these. | ||
| _apm_tracing = DDConfig.v(t.Optional[bool], "_dd.apm.tracing.agentless.enabled", default=None) | ||
| _ci_visibility = DDConfig.v(t.Optional[bool], "dd.civisibility.agentless.enabled", default=None) | ||
| _llmobs = DDConfig.v(t.Optional[bool], "dd.llmobs.agentless.enabled", default=None) | ||
|
|
||
| apm_tracing = DDConfig.d(bool, lambda c: c.enabled if c._apm_tracing is None else c._apm_tracing) | ||
| ci_visibility = DDConfig.d(bool, lambda c: c.enabled if c._ci_visibility is None else c._ci_visibility) | ||
| # LLM Observability keeps a third state: left unset (and with no global switch) it | ||
| # probes the agent at startup and decides then, so it must not collapse to False. | ||
| llmobs = DDConfig.d(t.Optional[bool], lambda c: True if c.enabled and c._llmobs is None else c._llmobs) | ||
|
|
||
| #: Whether anything at all submits agentlessly. Products without a transport | ||
| #: setting of their own (instrumentation telemetry) follow this. | ||
| any_enabled = DDConfig.d(bool, lambda c: bool(c.enabled or c.apm_tracing or c.ci_visibility or c.llmobs)) | ||
|
|
||
| def __init__(self, *args: t.Any, **kwargs: t.Any) -> None: | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| if self.enabled and not self.api_key: | ||
| msg = ( | ||
| "DD_AGENTLESS_ENABLED is set but DD_API_KEY is not. Agentless mode submits data " | ||
| "straight to the Datadog intake, which is not possible without an API key. " | ||
| "Set DD_API_KEY, or unset DD_AGENTLESS_ENABLED to submit through the agent." | ||
| ) | ||
| raise ValueError(msg) | ||
|
|
||
| def reported_configuration(self) -> "list[tuple[str, t.Any, str]]": | ||
| """The (environment variable, effective value, origin) triples to report as telemetry. | ||
|
|
||
| Agentless config is resolved early, and we thus must explicitly report our config. | ||
| """ | ||
| return [ | ||
| (env_name, value, self.value_source(env_name)) | ||
| for env_name, value in ( | ||
| ("DD_AGENTLESS_ENABLED", self.enabled), | ||
| ("DD_SITE", self.site), | ||
| ("_DD_APM_TRACING_AGENTLESS_ENABLED", self.apm_tracing), | ||
| ("DD_CIVISIBILITY_AGENTLESS_ENABLED", self.ci_visibility), | ||
| ("DD_LLMOBS_AGENTLESS_ENABLED", self.llmobs), | ||
| ) | ||
| ] | ||
|
|
||
|
|
||
| config = AgentlessConfig() | ||
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
When
DD_AGENTLESS_ENABLED=trueand LLMObs starts without an explicitDD_REMOTE_CONFIGURATION_ENABLED, this derivedTruereachesLLMObs.enable(), where the existing branch inddtrace/llmobs/_llmobs.py:1009-1012sets_remote_config_enabledto false and disables the poller. As a result, the advertised global agentless combination silently stops Remote Configuration whenever LLMObs is enabled; the legacy LLMObs-only disable path needs to distinguish an inherited global setting.Useful? React with 👍 / 👎.