Skip to content

[receiver/kubeletstats] Move receiver.kubeletstats.enableCPUUsageMetrics feature gate to beta #39488

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 5 commits into from
Apr 23, 2025

Conversation

odubajDT
Copy link
Contributor

@odubajDT odubajDT commented Apr 18, 2025

Link to tracking issue

Fixes #39487
Related to #27885

@@ -57,6 +57,31 @@ func newKubeletScraper(
metricsConfig metadata.MetricsBuilderConfig,
nodeName string,
) (scraper.Metrics, error) {
if EnableCPUUsageMetrics.IsEnabled() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this logic was moved to scraper due to easier testability -> all tests are using newKubeletScraper() function to initialize the scraper and test the exported metrics and therefore if the logic is present in the factory, there is no possibility to test the new behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving this check to the config validation?

Copy link
Member

Choose a reason for hiding this comment

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

We dont want to do that bc the result of the gate may change the config and generally it is a bad practice to modify the config in the validate function

                 metricsConfig.Metrics.ContainerCPUUtilization.Enabled = true
		metricsConfig.Metrics.K8sPodCPUUtilization.Enabled = true
		metricsConfig.Metrics.K8sNodeCPUUtilization.Enabled = true

@odubajDT odubajDT marked this pull request as ready for review April 18, 2025 08:39
@odubajDT odubajDT requested a review from a team as a code owner April 18, 2025 08:39
@odubajDT odubajDT force-pushed the kubeletstats-feature-gate branch from 38cd820 to 48a4719 Compare April 23, 2025 05:48
Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

LGTM! Thank's @odubajDT!

@odubajDT odubajDT requested a review from TylerHelmuth April 23, 2025 07:35
@@ -57,6 +57,31 @@ func newKubeletScraper(
metricsConfig metadata.MetricsBuilderConfig,
nodeName string,
) (scraper.Metrics, error) {
if EnableCPUUsageMetrics.IsEnabled() {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving this check to the config validation?

@TylerHelmuth TylerHelmuth merged commit 9a57b62 into open-telemetry:main Apr 23, 2025
172 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 23, 2025
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.

[receiver/kubeletstats] Move receiver.kubeletstats.enableCPUUsageMetrics feature gate to Beta
5 participants