Skip to content
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

Allow agent to monitor endpoint #4789

Merged
merged 39 commits into from
Jun 16, 2024

Conversation

fearful-symmetry
Copy link
Contributor

@fearful-symmetry fearful-symmetry commented May 21, 2024

What does this PR do?

closes #4083

This is a large and fairly wide-ranging set of changes that allows agent to monitor and report usage metrics for endpoint.
Specifically:

  • adds code to the coordinator and runtime controllers to filter PID changes up to the config system
  • Adds logic to the metrics input generator to add a system/process metricset to monitor endpoint
  • Add an integration test
  • Change the behavior of the local env var in mage, so local=agentbeat will only build agentbeat, then pull other binaries from upstream. Needed this for testing, but kept it because it seemed vaguely useful. However, we don't need to merge it.

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/fragments using the changelog tool
  • I have added an integration test or an E2E test

@fearful-symmetry fearful-symmetry added the Team:Elastic-Agent Label for the Agent team label May 21, 2024
@fearful-symmetry fearful-symmetry self-assigned this May 21, 2024
@fearful-symmetry fearful-symmetry changed the title Service monitoring Allow agent to monitor endpoint May 21, 2024
Copy link
Contributor

mergify bot commented May 21, 2024

This pull request does not have a backport label. Could you fix it @fearful-symmetry? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label May 21, 2024
@fearful-symmetry
Copy link
Contributor Author

So, TestCoordinatorReportsInvalidPolicy is broken, trying to figure out if I broke the coordinator, or just the test.

@fearful-symmetry fearful-symmetry marked this pull request as ready for review May 23, 2024 16:22
@fearful-symmetry fearful-symmetry requested a review from a team as a code owner May 23, 2024 16:22
@elasticmachine
Copy link
Contributor

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

@fearful-symmetry
Copy link
Contributor Author

CI may be various kinds of broken until the snapshot beats build are updated, taking out of draft since technically everything needed is merged.

@pierrehilbert pierrehilbert requested review from pchila and blakerouse and removed request for AndersonQ May 23, 2024 16:31
@fearful-symmetry
Copy link
Contributor Author

Still tinkering with the tests...

@fearful-symmetry
Copy link
Contributor Author

fearful-symmetry commented Jun 4, 2024

So, I ended up adding a decent bit of logic to the integration test, hopefully to better shake out any problems that might exist with the metric update logic. HOWEVER, I'm waiting for the elastic_agent integration to get pushed to prod in fleet, which is blocking me from making some of the test improvements Craig suggested. Should be in the next few days?

EDIT: tests are done, and working.

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Overall this looks good.

I would really like to see checkinpid to just be pid, but not a blocker.

Copy link
Contributor

@faec faec left a comment

Choose a reason for hiding this comment

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

Some suggestions on atomic handling, otherwise looks good

Copy link
Contributor

mergify bot commented Jun 12, 2024

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 service-monitoring upstream/service-monitoring
git merge upstream/main
git push upstream service-monitoring

@fearful-symmetry fearful-symmetry merged commit c929f79 into elastic:main Jun 16, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Team:Elastic-Agent Label for the Agent team 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.

Agent should collect and report CPU and memory usage of service runtime components
6 participants