Skip to content

locks: remove redundant beatPaths parameter#49837

Open
orestisfl wants to merge 2 commits intoelastic:mainfrom
orestisfl:locks-use-info-paths
Open

locks: remove redundant beatPaths parameter#49837
orestisfl wants to merge 2 commits intoelastic:mainfrom
orestisfl:locks-use-info-paths

Conversation

@orestisfl
Copy link
Copy Markdown
Contributor

@orestisfl orestisfl commented Apr 1, 2026

Proposed commit message

locks: remove redundant beatPaths parameter

locks.New and locks.NewWithRetry accepted both beat.Info and
*paths.Path. Now that Info carries Paths, drop the separate
argument and read it from beatInfo.Paths.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

None. Internal API change only.

How to test this PR locally

Related issues

@orestisfl orestisfl added refactoring Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-active-all Automated backport with mergify to all the active branches skip-changelog labels Apr 1, 2026
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@orestisfl orestisfl linked an issue Apr 1, 2026 that may be closed by this pull request
@orestisfl orestisfl force-pushed the locks-use-info-paths branch from 0d7b105 to ed5649d Compare April 1, 2026 14:30
Now that Paths lives in beat.Info, there is no need to pass it
as a separate argument alongside Info.
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9415ab6b-a8a5-4303-a4fe-494e839fe585

📥 Commits

Reviewing files that changed from the base of the PR and between 184a91b and d4574ad.

📒 Files selected for processing (3)
  • libbeat/cmd/instance/beat.go
  • libbeat/cmd/instance/locks/lock.go
  • libbeat/cmd/instance/locks/lock_test.go

📝 Walkthrough

Walkthrough

The pull request refactors the lock initialization pattern across the beat instance. The New and NewWithRetry functions in locks/lock.go were simplified to remove the explicit beatPaths parameter; they now derive the lockfile path directly from beatInfo.Paths. The corresponding call site in beat.go was updated to pass only beatInfo instead of both beatInfo and paths. Tests were similarly updated to supply paths through the beat.Info struct rather than as separate arguments. The locking behavior itself remains unchanged.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

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

@github-actions
Copy link
Copy Markdown
Contributor

TL;DR

Buildkite failures are all caused by one compile-time code bug: filebeat/beater/filebeat.go references b.Paths, but *beat.Beat has no Paths field. Replace it with b.Info.Paths to unblock check/update and both x-pack metricbeat integration jobs.

Remediation

  • In filebeat/beater/filebeat.go:498, change the autodiscover.NewAutodiscover(...) argument from b.Paths to b.Info.Paths.
  • Re-run:
    • make -C filebeat check update && make check-no-changes
    • make -C x-pack/filebeat check update && make check-no-changes
    • make -C x-pack/libbeat check update && make check-no-changes
    • cd x-pack/metricbeat && mage goIntegTest && mage goFIPSOnlyIntegTest
Investigation details

Root Cause

filebeat/beater/filebeat.go:498 passes b.Paths into autodiscover.NewAutodiscover(...), but *beat.Beat does not define Paths.

  • Failing callsite: filebeat/beater/filebeat.go:498
  • Beat definition (no Paths field): libbeat/beat/beat.go:59-91
  • Existing valid pattern in libbeat uses b.Info.Paths: libbeat/cmd/instance/beat.go:393

Evidence

# github.com/elastic/beats/v7/filebeat/beater
beater/filebeat.go:498:6: b.Paths undefined (type *beat.Beat has no field or method Paths)

Verification

  • Not run in this workflow (read-only detective mode).

Follow-up

After this fix, if metricbeat integration still fails, re-evaluate for any secondary runtime/test issues; current failures stop at compile time.

Note

🔒 Integrity filter blocked 2 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #49837 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • locks: remove redundant beatPaths parameter #49837 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches refactoring skip-changelog Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[beatreceiver] move paths object into Beat.Info

2 participants