Skip to content

[8.19] (backport #8031) Allow using beats receivers for self-monitoring #8102

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 1 commit into from
May 8, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented May 7, 2025

What does this PR do?

Adds the ability to use beats receivers for agent self-monitoring. To do so, we add a new configuration key to agent.monitoring named _runtime_experimental - identical to how you can currently switch inputs to the Otel runtime.

In terms of implementation, the changes are very straightforward. In the monitoring injection manager, we set the runtime manager for inputs we add, if it's set in the monitoring configuration.

Most of this PR's code changes lie in tests, and more specifically in the TestAgentMonitoring E2E test. This test compares the data collected by agent self-monitoring using beats processes to an equivalent Otel configuration of beats receivers in Hybrid mode. Instead of doing that, we can now just change agent.monitoring._runtime_experimental, so the test becomes much simpler conceptually.

I have simplified some of the test logic, but I haven't yet made it compare metrics. This should be doable now, but we have another PR (#8009 ) in-flight doing it, so I held off.

Why is it important?

We want to be able to use beats receivers for agent self-monitoring.

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

How to test this PR locally

Build the agent locally and use the following configuration:

outputs:
  default:
    type: elasticsearch
    hosts: [...]
    username: elastic
    password: "..."

inputs: []

agent:
  monitoring:
    metrics: true
    logs: true
    _runtime_experimental: otel

Looking at Kibana dashboards for the agent integration can prove the data is actually being ingested. You can verify that beats receivers are being used for self-monitoring by looking at their CPU usage - it should be 0.

Related issues


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

* Handle nil case in monitoring config parsing

* Allow using otel runtime for self-monitoring

# Conflicts:
#	internal/pkg/agent/application/monitoring/v1_monitor.go

# Conflicts:
#	internal/pkg/otel/configtranslate/otelconfig.go

* Modify e2e test

* Make the monitoring e2e test more restrictive

* Revert "Handle nil case in monitoring config parsing"

This reverts commit bb11a0f.

* Check receiver statuses in e2e test

* Send data from beats processes and receivers to different namespaces

* Check all component statuses in E2E test

* Fix typo

Co-authored-by: Khushi Jain <[email protected]>

---------

Co-authored-by: Khushi Jain <[email protected]>
(cherry picked from commit a31d56f)
@mergify mergify bot requested a review from a team as a code owner May 7, 2025 09:25
@mergify mergify bot added the backport label May 7, 2025
@mergify mergify bot requested review from kaanyalti and andrzej-stencel and removed request for a team May 7, 2025 09:25
@github-actions github-actions bot added enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog labels May 7, 2025
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

Copy link

@elasticmachine
Copy link
Contributor

elasticmachine commented May 7, 2025

@ycombinator ycombinator merged commit 1edabaa into 8.19 May 8, 2025
14 checks passed
@ycombinator ycombinator deleted the mergify/bp/8.19/pr-8031 branch May 8, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport enhancement New feature or request skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team 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.

3 participants