Skip to content

Conversation

VihasMakwana
Copy link
Contributor

Proposed commit message

Add a new manager interface for otel mode. This manager is created if management.otel.enabled is set to true.
We would set this flag true in elastic-agent.

The methods would be implemented later, when the diagnostic extension is implemented.

I am reluctant to reuse the management.enabled flag because the flag is used at many places to detect the fleet mode and it might break other things.

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.

Disruptive User Impact

None, as we're adding a new flag.

Related issues

Testing

If this approach sounds feasible, I'll add integration test cases for log input and unit test cases.

@VihasMakwana VihasMakwana requested review from a team as code owners September 11, 2025 10:21
@VihasMakwana VihasMakwana self-assigned this Sep 11, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 11, 2025
Copy link
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!)

@VihasMakwana VihasMakwana added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Sep 11, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 11, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

mergify bot commented Sep 11, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @VihasMakwana? 🙏.
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.

@VihasMakwana VihasMakwana added the backport-9.1 Automated backport to the 9.1 branch label Sep 11, 2025
Copy link
Contributor

@belimawr belimawr left a comment

Choose a reason for hiding this comment

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

Could you also address the lint warnings?

@belimawr
Copy link
Contributor

belimawr commented Sep 11, 2025

I was reading up more the linked issues and I believe the cleanest solution for this problem is to have a package like otelmode (similar to fleetmode) to set/check if a Beat is running under OTel management/OtelMode.

What do you think?

@VihasMakwana
Copy link
Contributor Author

I was reading up more the linked issues and I believe the cleanest solution for this problem is to have a package like otelmode (similar to fleetmode) to set/check if a Beat is running under OTel management/OtelMode.

Yes that, and we would also need a manager because in future we will implement the otel diagnostics extension.

@VihasMakwana
Copy link
Contributor Author

@cmacknz I've added a test for checking the log input while running under EDOT. Also expanded the existing tests to test the value of the global flag.

@cmacknz
Copy link
Member

cmacknz commented Sep 19, 2025

Yeah, it will be set in elastic-agent. We don't set any management flag right now for otel mode, so we will need to set management.enabled: true or management.enabled.otel: true anyhow. I think we should just set management.enabled.otel: true and this PR would work as it is, without the need of inferring.

I created elastic/elastic-agent#10069 to track this so we don't forget about it. TBH I think I'm more on the side of having management.enabed: true imply management.enabled.otel: true for beats receivers if we can just to avoid having to do changes across repositories and line up the matching backports more than anything else.

Following the chain of status reporters is quite complex and I was a reviewer on all the original PRs so I think we need some explanation on the new manager about where to look.

@cmacknz
Copy link
Member

cmacknz commented Sep 19, 2025

@belimawr you have changes requested that have been addressed here

@VihasMakwana VihasMakwana merged commit 4ba000d into elastic:main Sep 23, 2025
207 checks passed
mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* iniital commit

* cleanupt

* license

* comments

* comments

* comments

* rename

* comments and unit test case

* go.mod

* lint and notice

* use existing flag

* go.sum

* log input test and UnderAgent test

* test disabled

* stub and cleanup

* comment

* fixes and comments

(cherry picked from commit 4ba000d)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	libbeat/management/management.go
#	x-pack/libbeat/cmd/instance/beat.go
@cmacknz cmacknz added the backport-8.19 Automated backport to the 8.19 branch label Sep 23, 2025
@cmacknz
Copy link
Member

cmacknz commented Sep 23, 2025

Let's backport to 8.19 to keep the code structure the same

mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* iniital commit

* cleanupt

* license

* comments

* comments

* comments

* rename

* comments and unit test case

* go.mod

* lint and notice

* use existing flag

* go.sum

* log input test and UnderAgent test

* test disabled

* stub and cleanup

* comment

* fixes and comments

(cherry picked from commit 4ba000d)

# Conflicts:
#	NOTICE.txt
#	go.mod
VihasMakwana added a commit that referenced this pull request Sep 24, 2025
…46747)

* [beatreceiver] - add manager for otel mode  (#46539)

* iniital commit

* cleanupt

* license

* comments

* comments

* comments

* rename

* comments and unit test case

* go.mod

* lint and notice

* use existing flag

* go.sum

* log input test and UnderAgent test

* test disabled

* stub and cleanup

* comment

* fixes and comments

(cherry picked from commit 4ba000d)

# Conflicts:
#	NOTICE.txt
#	go.mod

* go.mod and notice

* beat_test

---------

Co-authored-by: Vihas Makwana <[email protected]>
Co-authored-by: Vihas <[email protected]>
VihasMakwana added a commit that referenced this pull request Sep 24, 2025
…6739)

* [beatreceiver] - add manager for otel mode  (#46539)

* iniital commit

* cleanupt

* license

* comments

* comments

* comments

* rename

* comments and unit test case

* go.mod

* lint and notice

* use existing flag

* go.sum

* log input test and UnderAgent test

* test disabled

* stub and cleanup

* comment

* fixes and comments

(cherry picked from commit 4ba000d)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	libbeat/management/management.go
#	x-pack/libbeat/cmd/instance/beat.go

* merge conflicts

* conflicts

---------

Co-authored-by: Vihas Makwana <[email protected]>
Co-authored-by: Vihas <[email protected]>
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 enhancement Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[filebeatreceiver] support log input
6 participants