[base] Add get_agent_embedded_path helper#23644
Draft
Kyle-Neale wants to merge 1 commit intomasterfrom
Draft
Conversation
Resolve paths under the agent's `embedded` directory by reading `run_path` from the agent config instead of assuming the install sits at `/opt/datadog-agent`. Works for both standard installs and Remote-Management installs at `/opt/datadog-packages/datadog-agent/<ver>`. Returns `None` when `run_path` is unset so callers can decide whether the miss is fatal (raise) or skip a fallback. Refs: AI-5681 Follow-up to #20574 which inlined this lookup in glusterfs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Validation ReportAll 20 validations passed. Show details
|
Contributor
|
✨ Fix all issues with BitsAI or with Cursor
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
get_agent_embedded_path(*parts)todatadog_checks_base.utils.agent.common, which readsrun_pathfrom the agent config and joins it underembedded/....Nonewhenrun_pathis unset so callers can decide whether the miss is fatal or a fallback./opt/datadog-agent/run) and Remote-Management installs (/opt/datadog-packages/datadog-agent/<version>/run).Motivation
When the agent is installed with Remote Management enabled, hardcoded
/opt/datadog-agentpaths silently miss because the actual install lives under/opt/datadog-packages/datadog-agent/<version>/. PR #20574 fixed this inline forglusterfs. This PR extracts a shared helper in the base check so the same fix can be applied to every affected integration (glusterfs,kafka_consumer,kafka_actions,nfsstat) in follow-up commits on this branch.Jira: AI-5681
Related: #20574
Test plan
ddev test -fs datadog_checks_base— cleanddev --no-interactive test datadog_checks_base -- -k test_agent_common— 5/5 passingglusterfs,kafka_consumer,kafka_actions,nfsstatand add per-integration tests🤖 Generated with Claude Code