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

[system/cpu,core] - Disable performance counter by default to unblock agent CI #42041

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

VihasMakwana
Copy link
Contributor

@VihasMakwana VihasMakwana commented Dec 14, 2024

Alternative to #42042.

This is a temporary fix as CI on elastic-agent's main is broken https://buildkite.com/elastic/elastic-agent-extended-testing/builds/5390#0193c17f-c655-422a-8dc9-ae5a7a40fdbd.

This most likely happened because user not having enough permissions to read from performance counter. I'll do some more digging and fix the underlying issue.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 14, 2024
@VihasMakwana VihasMakwana self-assigned this Dec 14, 2024
@VihasMakwana VihasMakwana added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Dec 14, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 14, 2024
@VihasMakwana VihasMakwana marked this pull request as ready for review December 14, 2024 10:26
@VihasMakwana VihasMakwana requested a review from a team as a code owner December 14, 2024 10:26
@elasticmachine
Copy link
Collaborator

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

Copy link
Contributor

mergify bot commented Dec 14, 2024

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

Copy link
Contributor

mergify bot commented Dec 14, 2024

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Dec 14, 2024
@VihasMakwana VihasMakwana enabled auto-merge (squash) December 14, 2024 10:32
@VihasMakwana
Copy link
Contributor Author

VihasMakwana commented Dec 16, 2024

I'll do some more digging and fix the underlying issue.

Sadly, the only way to fix it is by add the user to "Performance Monitoring Users" group on Windows.
When I was testing this in unprivileged mode on my VM, the elastic-agent user was already a member of the group, so I overlooked this detail.

@leehinman @cmacknz what should be the best way to proceed?

  1. Disabling this by default and updating the docs with required info.
    • I tend to prefer this option i.e. merging this PR.
  2. Enabling them and throwing warning, if any error is encountered.
    • i.e. this PR

@cmacknz
Copy link
Member

cmacknz commented Dec 16, 2024

Whether to use performance counters or not needs to become an explicit configuration exposed in the system integration as well as the module. Because this is configuration, in theory in the agent tests affected by this an agent PR that sets his same configuration to false could be made directly in agent so we don't have to wait for a new DRA build. Since it isn't in the integration yet, the fleet overrides API could be used.

Ideally, we would add ourselves to the Performance Monitor Users group automatically, but this will not help agents that were not already installed, so we need a way to handle that. Maybe just having it be configurable with the default value controlled by whether we are in the right group.

The DataDog agent installer adds itself to the performance monitor users group and some others for example https://docs.datadoghq.com/agent/guide/windows-agent-ddagent-user/

@cmacknz
Copy link
Member

cmacknz commented Dec 16, 2024

Please create an issue to track this problem so we don't lose the discussion in this PR

@VihasMakwana
Copy link
Contributor Author

Please create an issue to track this problem so we don't lose the discussion in this PR

Sure.

@VihasMakwana VihasMakwana merged commit f3a063f into elastic:main Dec 16, 2024
32 checks passed
mergify bot pushed a commit that referenced this pull request Dec 16, 2024
(cherry picked from commit f3a063f)

# Conflicts:
#	metricbeat/docs/modules/system.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/system/_meta/config.reference.yml
#	metricbeat/module/system/core/_meta/docs.asciidoc
#	metricbeat/module/system/core/config.go
#	metricbeat/module/system/cpu/_meta/docs.asciidoc
#	metricbeat/module/system/cpu/config.go
#	x-pack/metricbeat/metricbeat.reference.yml
VihasMakwana added a commit that referenced this pull request Dec 17, 2024
…r by default to unblock agent CI (#42055)

* chore: disable performance counters (#42041)

(cherry picked from commit f3a063f)

# Conflicts:
#	metricbeat/docs/modules/system.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/system/_meta/config.reference.yml
#	metricbeat/module/system/core/_meta/docs.asciidoc
#	metricbeat/module/system/core/config.go
#	metricbeat/module/system/cpu/_meta/docs.asciidoc
#	metricbeat/module/system/cpu/config.go
#	x-pack/metricbeat/metricbeat.reference.yml

* Fix Asciidoc formatting

---------

Co-authored-by: Vihas Makwana <[email protected]>
Co-authored-by: Vihas Makwana <[email protected]>
Co-authored-by: David Kilfoyle <[email protected]>
@VihasMakwana VihasMakwana added backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify labels Dec 17, 2024
mergify bot pushed a commit that referenced this pull request Dec 17, 2024
(cherry picked from commit f3a063f)

# Conflicts:
#	metricbeat/docs/modules/system.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/system/_meta/config.reference.yml
#	metricbeat/module/system/core/_meta/docs.asciidoc
#	metricbeat/module/system/core/config.go
#	metricbeat/module/system/cpu/_meta/docs.asciidoc
#	metricbeat/module/system/cpu/config.go
#	x-pack/metricbeat/metricbeat.reference.yml
mergify bot pushed a commit that referenced this pull request Dec 17, 2024
(cherry picked from commit f3a063f)

# Conflicts:
#	metricbeat/docs/modules/system.asciidoc
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/system/_meta/config.reference.yml
#	metricbeat/module/system/core/_meta/docs.asciidoc
#	metricbeat/module/system/core/config.go
#	metricbeat/module/system/cpu/_meta/docs.asciidoc
#	metricbeat/module/system/cpu/config.go
#	x-pack/metricbeat/metricbeat.reference.yml
VihasMakwana added a commit that referenced this pull request Dec 18, 2024
VihasMakwana added a commit that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify 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.

4 participants