Skip to content

refactor: restore parameterless NewFactory functions for Beat receivers#49571

Merged
andrzej-stencel merged 2 commits intoelastic:mainfrom
andrzej-stencel:beat-receivers-newfactory-parameterless
Mar 20, 2026
Merged

refactor: restore parameterless NewFactory functions for Beat receivers#49571
andrzej-stencel merged 2 commits intoelastic:mainfrom
andrzej-stencel:beat-receivers-newfactory-parameterless

Conversation

@andrzej-stencel
Copy link
Contributor

@andrzej-stencel andrzej-stencel commented Mar 19, 2026

To keep them compatible with OpenTelemetry Collector Builder.

Proposed commit message

Restores parameterless NewFactory functions for Filebeat receiver and Metricbeat receiver to keep their API compatible with OpenTelemetry Collector Builder, which requires parameterless NewFactory function.

The function NewFactoryWithSettings(Settings) has been introduced for use in the Elastic Agent to inject settings in runtime.

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. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

To keep them compatible with OpenTelemetry Collector Builder.
@andrzej-stencel andrzej-stencel added backport-skip Skip notification from the automated backport with mergify Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Mar 19, 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 Mar 19, 2026
@github-actions
Copy link
Contributor

🤖 GitHub comments

Just comment with:

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

Both changes will land in the same release, so the second change doesn't break anything.
@andrzej-stencel andrzej-stencel marked this pull request as ready for review March 19, 2026 13:48
@andrzej-stencel andrzej-stencel requested a review from a team as a code owner March 19, 2026 13:48
@elasticmachine
Copy link
Contributor

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

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2c9e14c1-170c-4ccb-9e4a-c851052d9f3f

📥 Commits

Reviewing files that changed from the base of the PR and between eff0889 and c249d71.

📒 Files selected for processing (8)
  • changelog/fragments/1773087971-change-beat-receiver-factory-to-have-default-home-and-path-directories.yaml
  • x-pack/filebeat/fbreceiver/factory.go
  • x-pack/filebeat/fbreceiver/receiver_leak_test.go
  • x-pack/filebeat/fbreceiver/receiver_test.go
  • x-pack/metricbeat/mbreceiver/factory.go
  • x-pack/metricbeat/mbreceiver/receiver_leak_test.go
  • x-pack/metricbeat/mbreceiver/receiver_test.go
  • x-pack/otel/oteltestcol/collector.go

📝 Walkthrough

Walkthrough

Refactored receiver factory constructors across filebeat and metricbeat modules. Renamed the existing parameterized factory functions to NewFactoryWithSettings() and added new parameterless NewFactory() functions that instantiate factories with default empty settings. Updated all corresponding test files and a test collector to call the appropriate factory variant—NewFactoryWithSettings() when custom settings are required, and NewFactory() for default configurations. Updated changelog metadata accordingly.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@andrzej-stencel andrzej-stencel merged commit 665ea4a into elastic:main Mar 20, 2026
52 checks passed
@andrzej-stencel andrzej-stencel deleted the beat-receivers-newfactory-parameterless branch March 20, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip notification from the automated backport with mergify 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.

4 participants