Skip to content

otel: allow filebeat otel to load otel config files#45093

Merged
mauri870 merged 9 commits intoelastic:mainfrom
mauri870:filebeat-otel-config
Jul 1, 2025
Merged

otel: allow filebeat otel to load otel config files#45093
mauri870 merged 9 commits intoelastic:mainfrom
mauri870:filebeat-otel-config

Conversation

@mauri870
Copy link
Copy Markdown
Member

@mauri870 mauri870 commented Jun 27, 2025

Proposed commit message

Currently the filebeat otel command only loads beats config files, which it then translates to beats receivers in order to run a OTel collector.

This PR augments this functionality to allow the command to load otel configuration files, this aids in testing and running beats receivers in a standalone collector without depending on EDOT.

How to test

cd x-pack/filebeat/
go test -c -tags otelbeat
mage docker:composeUp
go test   -tags "integration" -run 'TestFilebeatOTel.*' ./tests/integration -v -count=1

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related

@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 27, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

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

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jun 27, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @mauri870? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@mauri870 mauri870 added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jun 27, 2025
Currently the filebeat otel command only loads beats config files, which
it then translates to beats receivers in order to run a OTel collector.

This PR augments this functionality to allow the command to load otel
configuration files, this aids in testing and running beats receivers in a standalone collector.
@mauri870 mauri870 force-pushed the filebeat-otel-config branch from 7571341 to 2d668c9 Compare June 27, 2025 17:42
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Jun 30, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b filebeat-otel-config upstream/filebeat-otel-config
git merge upstream/main
git push upstream filebeat-otel-config

@mauri870 mauri870 marked this pull request as ready for review June 30, 2025 15:42
@mauri870 mauri870 requested review from a team as code owners June 30, 2025 15:42
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@mauri870 mauri870 force-pushed the filebeat-otel-config branch from a47c49f to 818c4c8 Compare June 30, 2025 16:18
@mauri870
Copy link
Copy Markdown
Member Author

/test

Comment thread x-pack/filebeat/tests/integration/otel_test.go
Copy link
Copy Markdown
Contributor

@khushijain21 khushijain21 left a comment

Choose a reason for hiding this comment

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

LGTM

@khushijain21
Copy link
Copy Markdown
Contributor

This should be backported to 8.19 as well, I believe

mauri870 added a commit that referenced this pull request Jul 2, 2025
… files (#45133)

* otel: allow filebeat otel to load otel config files (#45093)

* otel: allow filebeat otel to load otel config files

Currently the filebeat otel command only loads beats config files, which
it then translates to beats receivers in order to run a OTel collector.

This PR augments this functionality to allow the command to load otel
configuration files, this aids in testing and running beats receivers in a standalone collector.

* update notice

* add test for multiple receivers

* fix monitoring port

* test refactor for template

* restore condition removed by mistake

* allow monitoring http request with variable url

(cherry picked from commit 46e855e)

* fix linter error

---------

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit to mauri870/beats that referenced this pull request Jul 2, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
elastic#45093. Skip this test for now.
id: filestream-fbreceiver
enabled: true
paths:
- {{$receiver.InputFile}}
Copy link
Copy Markdown
Contributor

@khushijain21 khushijain21 Jul 3, 2025

Choose a reason for hiding this comment

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

Hello @mauri870, I just realized that both the receivers are using the same directory. The registry is going to be updated by both receivers at the same time. And since they are ingesting the same log file - there is likely going to be data loss here.

Were you able to test this? I am afarid we will turn out to see this as another flaky test.

It is also best to use unqiue namespaces for both receivers

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, you are absolutely right. I ran these tests with stress for half an hour but did not find any issues, but they are definitely bound to happen at some point.

Comment thread x-pack/filebeat/tests/integration/otel_test.go
Copy link
Copy Markdown
Contributor

@khushijain21 khushijain21 left a comment

Choose a reason for hiding this comment

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

Sorry for bringing up few comments after this was merged

mauri870 added a commit that referenced this pull request Jul 3, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.
mergify Bot pushed a commit that referenced this pull request Jul 3, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mergify Bot pushed a commit that referenced this pull request Jul 3, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)
mergify Bot pushed a commit that referenced this pull request Jul 3, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mauri870 added a commit that referenced this pull request Jul 3, 2025
This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Jul 3, 2025
…vers (#45166)

* [oteltest][fbreceiver]: skip TestMultipleReceivers (#45147)

This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

* fix conflicts

---------

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit that referenced this pull request Jul 3, 2025
…ivers (#45168)

* [oteltest][fbreceiver]: skip TestMultipleReceivers (#45147)

This test is flaking for a while with a high failure rate. We
have an integration test that covers the same scenario added by
#45093. Skip this test for now.

(cherry picked from commit 5069a00)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

* fix conflicts

---------

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
mauri870 added a commit to mauri870/beats that referenced this pull request Jul 10, 2025
As a leftover from elastic#45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.
mauri870 added a commit that referenced this pull request Jul 11, 2025
As a leftover from #45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.
mergify Bot pushed a commit that referenced this pull request Jul 11, 2025
As a leftover from #45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.

(cherry picked from commit ea98564)

# Conflicts:
#	x-pack/filebeat/tests/integration/otel_test.go
mergify Bot pushed a commit that referenced this pull request Jul 11, 2025
As a leftover from #45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.

(cherry picked from commit ea98564)

# Conflicts:
#	x-pack/filebeat/tests/integration/otel_test.go
mergify Bot pushed a commit that referenced this pull request Jul 11, 2025
As a leftover from #45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.

(cherry picked from commit ea98564)
mauri870 added a commit that referenced this pull request Jul 11, 2025
…45319)

As a leftover from #45093, the
tests added reuse the index names which may cause issues when running
the tests in sequence without cleaning up first.

Adjusted the existing tests to use unique indexes.

(cherry picked from commit ea98564)

Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
@mauri870 mauri870 added the backport-9.1 Automated backport to the 9.1 branch label Jul 11, 2025
mergify Bot pushed a commit that referenced this pull request Jul 11, 2025
* otel: allow filebeat otel to load otel config files

Currently the filebeat otel command only loads beats config files, which
it then translates to beats receivers in order to run a OTel collector.

This PR augments this functionality to allow the command to load otel
configuration files, this aids in testing and running beats receivers in a standalone collector.

* update notice

* add test for multiple receivers

* fix monitoring port

* test refactor for template

* restore condition removed by mistake

* allow monitoring http request with variable url

(cherry picked from commit 46e855e)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	x-pack/libbeat/common/otelbeat/otel.go
@mauri870
Copy link
Copy Markdown
Member Author

Huh, for some reason there was no backport for 9.1 even with the backport-active-9 label.

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

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches 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.

5 participants