Skip to content

[8.19] (backport #8737) Move beat receiver component logic to the otel manager #8990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 14, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 14, 2025

NOTE: This is an alternative implementation of #8529, which adds the new functionality to the existing Otel manager, instead of creating a new object for it.

What does this PR do?

Move beat receiver component logic to the otel manager.

This logic consists of two tasks conceptually:

  • Translating agent configurations into beats receiver configurations for the otel collector.
  • Translating otel collector statuses into component states.

Up until now, the logic for these was haphazardly spread across the agent coordinator. This PR moves all of it into the OtelManager, which can now run both raw otel collector configurations and agent components in a single otel collector instance.

The OtelManager now encapsulates all the logic involved in interfacing between the agent coordinator and the otel collector. In the near future, it will also take on additional responsibilities, like generating diagnostics for components it runs.

The only new logic this PR introduces lives in the new manager's main loop, and has to do with how updates and configurations are moved around. The rest is either existing logic moved to a new location, and new tests for that old logic.

Why is it important?

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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
  • [ ] I have added an integration test or an E2E test

Related issues


This is an automatic backport of pull request #8737 done by [Mergify](https://mergify.com).

* Add initial otel component manager implementation

* Update coordinator to use the new manager

* Move logging to the coordinator

* Add more tests

* Don't use a real otel manager in tests

* Move the logic to the otel manager

* Ignore the test collector binary

* Rename some dangling attributes back

* Comment out temporarily unused code

* Restore manager e2e test

* Fix import order

* Write synthetic status updates directly into the external channel

* Update collector config and components in one call

* Rename the mutex in the otel manager

* Discard intermediate statuses

* Emit component updates in a single batch

* Undo timeout increase in test

(cherry picked from commit 503421f)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator.go
#	internal/pkg/agent/application/coordinator/coordinator_unit_test.go
@mergify mergify bot requested a review from a team as a code owner July 14, 2025 10:52
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Jul 14, 2025
@mergify mergify bot requested review from blakerouse and pkoutsovasilis and removed request for a team July 14, 2025 10:52
@mergify mergify bot added conflicts There is a conflict in the backported pull request backport labels Jul 14, 2025
Copy link
Contributor Author

mergify bot commented Jul 14, 2025

Cherry-pick of 503421f has failed:

On branch mergify/bp/8.19/pr-8737
Your branch is up to date with 'origin/8.19'.

You are currently cherry-picking commit 503421fc8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   .gitignore
	modified:   internal/pkg/agent/application/application.go
	modified:   internal/pkg/agent/application/coordinator/coordinator_test.go
	modified:   internal/pkg/otel/manager/common.go
	modified:   internal/pkg/otel/manager/execution_subprocess.go
	modified:   internal/pkg/otel/manager/manager.go
	modified:   internal/pkg/otel/manager/manager_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   internal/pkg/agent/application/coordinator/coordinator.go
	both modified:   internal/pkg/agent/application/coordinator/coordinator_unit_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@github-actions github-actions bot added enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog labels Jul 14, 2025
@elasticmachine
Copy link
Collaborator

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

Copy link

@swiatekm swiatekm enabled auto-merge (squash) July 14, 2025 14:01
@swiatekm swiatekm merged commit 2ce0e06 into 8.19 Jul 14, 2025
19 checks passed
@swiatekm swiatekm deleted the mergify/bp/8.19/pr-8737 branch July 14, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport conflicts There is a conflict in the backported pull request enhancement New feature or request skip-changelog 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.

2 participants