Skip to content

Supporting a minimal install for local context 3rd party tools#2620

Merged
natoscott merged 7 commits into
performancecopilot:mainfrom
natoscott:local-config
Jun 18, 2026
Merged

Supporting a minimal install for local context 3rd party tools#2620
natoscott merged 7 commits into
performancecopilot:mainfrom
natoscott:local-config

Conversation

@natoscott

@natoscott natoscott commented Jun 15, 2026

Copy link
Copy Markdown
Member

Related to #2615

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Introduces two centralized make macros (PMCDCONF_MAKERULE and LOCALCONF_MAKERULE) in src/include/builddefs.in to replace per-PMDA inline shell logic. Adds local.conf as a new parallel PMDA configuration file alongside pmcd.conf, wires its generation and installation into the top-level pmdas build, and migrates all PMDA GNUmakefiles to use the new variables and macros. Updates Debian packaging to include the new files.

Changes

Centralized PMDA Config Generation with local.conf Support

Layer / File(s) Summary
Centralized PMCDCONF_MAKERULE and LOCALCONF_MAKERULE macros
src/include/builddefs.in
Defines PMCDCONF_MAKERULE and LOCALCONF_MAKERULE: each conditionally appends its configured line to ../pmcd.conf or ../local.conf only when the file exists and the line is absent, replacing duplicated inline shell logic across all PMDAs.
Top-level pmdas build, install, and gitignore wiring for local.conf and root.local
src/pmdas/GNUmakefile, src/pmdas/.gitignore
Adds local.conf and root.local to LDIRT, copies the generated pmcd.conf into local.conf during default_pcp, collects PMDA root files from local.conf and assembles them via pmcpp and awk into root.local, installs local.conf alongside indom.conf into $(PCP_ETC_DIR)/pcp and root.local into $(PCP_PMNSDIR), and ignores both in git.
Per-PMDA GNUmakefile migration to centralized makerules
src/pmdas/aix/GNUmakefile, src/pmdas/btrfs/GNUmakefile, src/pmdas/cifs/GNUmakefile, src/pmdas/darwin/GNUmakefile, src/pmdas/darwin_proc/GNUmakefile, src/pmdas/denki/GNUmakefile, src/pmdas/dm/GNUmakefile, src/pmdas/etw/GNUmakefile, src/pmdas/freebsd/GNUmakefile, src/pmdas/jbd2/GNUmakefile, src/pmdas/kvm/GNUmakefile, src/pmdas/linux/GNUmakefile, src/pmdas/linux_proc/GNUmakefile, src/pmdas/linux_xfs/GNUmakefile, src/pmdas/mmv/GNUmakefile, src/pmdas/netbsd/GNUmakefile, src/pmdas/openbsd/GNUmakefile, src/pmdas/pmcd/GNUmakefile, src/pmdas/root/GNUmakefile, src/pmdas/solaris/GNUmakefile, src/pmdas/windows/GNUmakefile
Each PMDA replaces its single CONF_LINE variable and inline grep/append shell block with PMCDCONF_LINE and LOCALCONF_LINE assignments, then delegates config file updates to $(PMCDCONF_MAKERULE) and $(LOCALCONF_MAKERULE) in its build-me or default_pcp recipe. Some PMDAs (linux, linux_proc, linux_xfs, kvm, darwin_proc) now carry distinct PMCDCONF_LINE and LOCALCONF_LINE values encoding different entry types (pipe/binary vs. dso/init).
Debian pcp-conf package manifest expansion
debian/pcp-conf.install
Adds etc/pcp.conf, etc/pcp/indom.conf, etc/pcp/labels.conf, etc/pcp/local.conf, usr/libexec/pcp/pmdas/*/root_*, var/lib/pcp/config/derived/*, and var/lib/pcp/pmns/root_* including the newly generated var/lib/pcp/pmns/root.local to the Debian install manifest.

Possibly related PRs

  • performancecopilot/pcp#2618: Introduces the Btrfs PMDA src/pmdas/btrfs/GNUmakefile and its build/install targets, which this PR directly modifies to add LOCALCONF_LINE and $(LOCALCONF_MAKERULE).

Poem

🐇 Hoppity-hop through the makefile maze,
No more grep shells in a tangled haze!
PMCDCONF_MAKERULE — one rule to reign,
local.conf born from pmcd.conf's brain.
Every PMDA now speaks the same tongue,
The config refactor has finally been sung! 🎶

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether any description relates to the changeset. Provide a pull request description that explains the motivation, approach, and impact of supporting minimal local context installations.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main objective of enabling minimal installation support for local context third-party tools, which is directly reflected in the changeset's focus on local configuration infrastructure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/include/builddefs.in`:
- Around line 532-545: The grep commands in both PMCDCONF_MAKERULE and
LOCALCONF_MAKERULE (lines 534 and 541) currently use regex-based pattern
matching, which is unsafe if configuration line values ever contain regex
metacharacters. Fix this by adding the -F flag to both grep commands to enable
fixed-string exact-line matching. Specifically, change grep -c to grep -F -c in
the conditional checks that validate whether PMCDCONF_LINE already exists in
../pmcd.conf and whether LOCALCONF_LINE already exists in ../local.conf.

In `@src/pmdas/darwin_proc/GNUmakefile`:
- Line 2: The copyright year range on line 2 of the GNUmakefile contains a typo
where "2025-20926" should be "2025-2026". Correct this typo by updating the
copyright header to use the proper year range format. This is a simple text
correction in the comment header to fix the accidental digit transposition.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: cfaec185-09ba-49ef-9cb5-09ea892c3852

📥 Commits

Reviewing files that changed from the base of the PR and between 62bd06c and 3e8de5a.

📒 Files selected for processing (25)
  • debian/pcp-conf.install
  • src/include/builddefs.in
  • src/pmdas/.gitignore
  • src/pmdas/GNUmakefile
  • src/pmdas/aix/GNUmakefile
  • src/pmdas/btrfs/GNUmakefile
  • src/pmdas/cifs/GNUmakefile
  • src/pmdas/darwin/GNUmakefile
  • src/pmdas/darwin_proc/GNUmakefile
  • src/pmdas/denki/GNUmakefile
  • src/pmdas/dm/GNUmakefile
  • src/pmdas/etw/GNUmakefile
  • src/pmdas/freebsd/GNUmakefile
  • src/pmdas/jbd2/GNUmakefile
  • src/pmdas/kvm/GNUmakefile
  • src/pmdas/linux/GNUmakefile
  • src/pmdas/linux_proc/GNUmakefile
  • src/pmdas/linux_xfs/GNUmakefile
  • src/pmdas/mmv/GNUmakefile
  • src/pmdas/netbsd/GNUmakefile
  • src/pmdas/openbsd/GNUmakefile
  • src/pmdas/pmcd/GNUmakefile
  • src/pmdas/root/GNUmakefile
  • src/pmdas/solaris/GNUmakefile
  • src/pmdas/windows/GNUmakefile

Comment thread src/include/builddefs.in
Comment thread src/pmdas/darwin_proc/GNUmakefile Outdated
@natoscott natoscott force-pushed the local-config branch 2 times, most recently from 9cdb54b to 6fe2546 Compare June 15, 2026 05:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/pmdas/GNUmakefile (1)

74-93: 💤 Low value

Consider creating an empty root.local as fallback for robustness.

If no PMDAs produce root_* files, root.local won't be created, but install_pcp (line 104) unconditionally tries to install it. While this is unlikely in practice given the expected PMDA set, adding a fallback would prevent build failures in minimal or unusual configurations.

🛡️ Suggested fallback
 	    > root.local; \
-	fi
+	else \
+	    echo "root {" > root.local && echo "}" >> root.local; \
+	fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pmdas/GNUmakefile` around lines 74 - 93, The root.local file is only
created when PMDAs with root_* files are found, but the install_pcp target (line
104) unconditionally attempts to install it, which will fail if no such files
exist. Add a fallback mechanism after the existing conditional block that
creates an empty root.local file if it wasn't already generated, ensuring the
build succeeds in minimal configurations where no PMDAs produce root_* files.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/pmdas/GNUmakefile`:
- Around line 74-93: The root.local file is only created when PMDAs with root_*
files are found, but the install_pcp target (line 104) unconditionally attempts
to install it, which will fail if no such files exist. Add a fallback mechanism
after the existing conditional block that creates an empty root.local file if it
wasn't already generated, ensuring the build succeeds in minimal configurations
where no PMDAs produce root_* files.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 87a2fe5d-e52f-4475-b914-e516e8a2c04b

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe2546 and 54fb676.

📒 Files selected for processing (3)
  • debian/pcp-conf.install
  • src/pmdas/.gitignore
  • src/pmdas/GNUmakefile
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/pmdas/.gitignore
  • debian/pcp-conf.install

@natoscott

Copy link
Copy Markdown
Member Author

Consider creating an empty root.local as fallback for robustness.

This is unnecessary - all platforms provide a kernel and MMV DSO PMDA at the very least.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pmdas/GNUmakefile`:
- Line 104: The install command in the GNUmakefile is incorrectly using the `-t`
flag with a file path instead of a directory. The `-t` flag expects a directory
destination, but $(PCP_PMNS_DIR)/root.local is a file path. Replace this single
install command with separate install commands that install root.local to each
of its two intended destinations: $(PCP_PMNS_DIR)/root.local and
$(PCP_PMNSADM_DIR)/root.local, without using the `-t` flag and instead
specifying the complete destination file paths directly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 6941bc9e-e6c0-43a2-9c18-a91c5ad4feda

📥 Commits

Reviewing files that changed from the base of the PR and between 54fb676 and eb3d2ec.

📒 Files selected for processing (3)
  • debian/pcp-conf.install
  • src/pmdas/.gitignore
  • src/pmdas/GNUmakefile
✅ Files skipped from review due to trivial changes (1)
  • src/pmdas/.gitignore
🚧 Files skipped from review as they are similar to previous changes (1)
  • debian/pcp-conf.install

Comment thread src/pmdas/GNUmakefile Outdated
@natoscott natoscott force-pushed the local-config branch 3 times, most recently from 8b6ea65 to 8fe087a Compare June 16, 2026 03:06
Comment thread qa/1742
Comment thread src/pmdas/denki/GNUmakefile
Comment thread debian/pcp-conf.install
Comment thread src/pmdas/.gitignore
Comment thread src/pmdas/GNUmakefile
natoscott and others added 6 commits June 18, 2026 11:11
Arrange for the build to produce /etc/pcp/local.conf for use
with pmNewContext(PM_CONTEXT_LOCAL,...) so that PMAPI clients
can use DSO PMDAs for sampling using just pcp-libs installed,
and no pmcd installed/running if they wish.

Related to performancecopilot#2615.
Arrange for the root_* namespace files to be installed via the
pcp-conf package, so that pmNewContext(PM_CONTEXT_LOCAL,...) in
PMAPI clients can use DSO PMDAs for sampling using just pcp-conf
and pcp-libs installed.  The final step is to add a "root.local"
without cpp-directives (there is no pmcpp(1) binary is available
in this minimal install situation).

Related to performancecopilot#2615.
During the build, generate a merged PMNS root.local containing the
combined namespace for all DSO PMDAs listed in local.conf.  Uses
pmcpp.static to resolve domain macros and awk to merge the separate
root{} blocks from each PMDA's root_* file into a single namespace.

Install root.local to PCP_PMNS_DIR as part of pcp-conf, alongside
the existing per-PMDA root_* files.  Clients using PM_CONTEXT_LOCAL
can select this namespace via PMNS_DEFAULT.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
PMDAs contributing root_* files to pcp-conf were installing a real
file copy to both $(PMDAADMDIR) and $(PCP_PMNSADM_DIR).  Make the
$(PCP_PMNSADM_DIR) and $(PCP_PMNS_DIR) entries symlinks back to the
canonical copy in $(PMDAADMDIR) instead.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
QA test 1742 exercises PM_CONTEXT_LOCAL using PCP_PMCDCONF_PATH=local.conf
and PMNS_DEFAULT=root.local: verifies hinv.ncpu is fetchable, mmv wildcard
resolution works, and pmcd.* metrics are absent from the local namespace.

Document PCP_PMCDCONF_PATH and PMNS_DEFAULT usage for local context in
pcpintro(1), including the recommended pairing of local.conf + root.local.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@natoscott natoscott force-pushed the local-config branch 2 times, most recently from 6ec5d73 to 2cd0754 Compare June 18, 2026 03:12
Rename the generated local context PMNS file from root.local to
local.root throughout (GNUmakefile, .gitignore, pcp-conf.install,
QA test 1742, pcpintro.1).

Also fix pcp-conf.install to use usr/lib/pcp/ rather than
usr/libexec/pcp/ for the new entries - Debian sets libexecdir=/usr/lib
so $(PCP_PMNSADM_DIR) resolves correctly in the makefiles but the
static paths in the install manifest must match.

Addresses review feedback from Kenj.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@natoscott natoscott merged commit cf8cdf4 into performancecopilot:main Jun 18, 2026
17 checks passed
@natoscott natoscott deleted the local-config branch June 18, 2026 07:50
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.

2 participants