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

[receiver/hostmetrics] Add cache_boot_time field to process scrapers #31998

Closed
wants to merge 1 commit into from

Conversation

braydonk
Copy link
Contributor

Description:
This PR adds the cache_boot_time config option to the process and processes scrapers. This allows an option for gopsutil functionality that will cache boot times after the first time they are fetched. It has a significant positive effect on the CPU usage of these scrapers.

Link to tracking Issue:
#28849

Testing:
Tested a build of the collector with these fields on and off and took CPU profiles to check the difference and see that common.BootTimeWithContext calls disappear after the first scrape.

Documentation:
TODO

This PR adds the `cache_boot_time` config option to the `process` and
`processes` scrapers. This allows an option for `gopsutil` functionality
that will cache boot times after the first time they are fetched. It has
a significant positive effect on the CPU usage of these scrapers.
@braydonk braydonk requested review from dmitryax and a team as code owners March 27, 2024 03:59
@braydonk braydonk changed the title Add cache_boot_time field to process scrapers [receiver/hostmetrics] Add cache_boot_time field to process scrapers Mar 27, 2024
@braydonk braydonk marked this pull request as draft March 27, 2024 04:03
@@ -13,4 +13,8 @@ type Config struct {
// MetricsBuilderConfig allows customizing scraped metrics/attributes representation.
metadata.MetricsBuilderConfig `mapstructure:",squash"`
internal.ScraperConfig

// CacheBootTime enables caching of the boot time of the system and each process. This means the
// boot times will never be updated as long as the collector is running.
Copy link
Member

Choose a reason for hiding this comment

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

What are the downsides of enabling it? Should we consider enabling it without a config option?

@braydonk
Copy link
Contributor Author

braydonk commented Apr 2, 2024

Closing in favour of #32126

@braydonk braydonk closed this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants