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

[cpu] - Split the initialisation into multiple files #194

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

VihasMakwana
Copy link
Contributor

This PR is a split from #192.
It aims to simplify the query building for performance counters.

Using a global variable might create problems if multiple modules (cpu and core) are trying to initialise it at a same time.
sync.Once adds unnecessary CPU overhead (makes it 4x slower).

Instead, we can initialise the performance counters in New(...) and return error to the caller (i.e. metricbeat).

@VihasMakwana VihasMakwana added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Dec 3, 2024
@VihasMakwana VihasMakwana self-assigned this Dec 3, 2024
@VihasMakwana VihasMakwana marked this pull request as ready for review December 3, 2024 14:05
@VihasMakwana VihasMakwana requested a review from a team as a code owner December 3, 2024 14:05
Copy link
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

Thank You for getting the query out of init(). This is much better.

@VihasMakwana VihasMakwana merged commit 1ac0416 into elastic:main Dec 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants