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

Enable additional metrics for kubelet metrics receiver #546

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Nov 4, 2024

The k8s.{pod/node/container}.cpu.utilization metrics are deprecated in favor of k8s.{pod/node/container}.cpu.usage. However, they are not enabled by default. We start collecting early, so when the `.cpu. utilisation metrics are removed, we will have enough data backfilled. Add uptime and container req/limit metrics.

Summary by CodeRabbit

  • New Features

    • Enhanced monitoring capabilities with the addition of new metrics for CPU usage and uptime across nodes and pods.
  • Bug Fixes

    • Addressed redundancy in the clusterName key to prevent potential configuration conflicts.

Copy link

coderabbitai bot commented Nov 4, 2024

Walkthrough

The pull request introduces modifications to the values.yaml file for the Kubernetes infrastructure chart, specifically enhancing the kubeletMetrics section by enabling multiple new metrics related to CPU and uptime for nodes, pods, and containers. Additionally, it addresses redundancy in the clusterName key within the global section, which appears twice as an empty string. The overall structure of the configuration remains unchanged aside from these additions.

Changes

File Path Change Summary
charts/k8s-infra/values.yaml - Added new metrics under kubeletMetrics: k8s.node.cpu.usage, k8s.node.uptime, k8s.pod.cpu.usage, k8s.pod.uptime, container.cpu.usage, k8s.container.cpu_limit_utilization, k8s.container.cpu_request_utilization, k8s.container.memory_limit_utilization, k8s.container.memory_request_utilization, container.uptime (all set to enabled: true).
- Noted redundancy in the clusterName key defined twice as an empty string.

Possibly related PRs

Suggested reviewers

  • prashant-shahi

🐇 In the fields where metrics grow,
New insights we shall sow.
Uptime, usage, all in sight,
Monitoring made just right!
With clarity, we’ll configure,
A Kubernetes world, we’ll rigor! 🌱


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@srikanthccv srikanthccv marked this pull request as ready for review November 4, 2024 08:43
@srikanthccv srikanthccv requested a review from a team as a code owner November 4, 2024 08:43
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
charts/k8s-infra/values.yaml (1)

Line range hint 1-24: Fix duplicate clusterName configuration.

The clusterName key appears twice in the configuration:

  1. Line 12: Under the global section
  2. Line 24: At the root level

This duplication could lead to confusion and potential misconfiguration.

Apply this diff to remove the duplicate and consolidate the configuration:

# Global override values
global:
  # -- Overrides the Docker registry globally for all images
  imageRegistry: null
  # -- Global Image Pull Secrets
  imagePullSecrets: []
  # -- Overrides the storage class for all PVC with persistence enabled.
  storageClass: null
  # -- Kubernetes cluster domain
  # It is used only when components are installed in different namespace
  clusterDomain: cluster.local
  # -- Kubernetes cluster name
  # It is used to attached to telemetry data via resource detection processor
  clusterName: ""
  # -- Deployment environment to be attached to telemetry data
  deploymentEnvironment: ""
  # -- Kubernetes cluster cloud provider along with distribution if any.
  # example: `aws`, `azure`, `gcp`, `gcp/autogke`, `azure`, and `other`
  cloud: other

# -- K8s infra chart name override
nameOverride: ""

# -- K8s infra chart full name override
fullnameOverride: ""

# -- Whether to enable K8s infra chart
enabled: true

- # -- Name of the K8s cluster. Used by OtelCollectors to attach in telemetry data.
- clusterName: ""
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0a250ce and 450cbbc.

📒 Files selected for processing (1)
  • charts/k8s-infra/values.yaml (2 hunks)
🔇 Additional comments (1)
charts/k8s-infra/values.yaml (1)

Line range hint 216-243: LGTM! The new metrics align with the PR objectives.

The enabled metrics appropriately address:

  1. CPU usage metrics to replace deprecated utilization metrics
  2. Uptime metrics for nodes, pods, and containers
  3. Resource utilization metrics for container limits and requests

Let's verify the metrics configuration:

✅ Verification successful

LGTM! The metrics configuration is correctly implemented

After reviewing the complete configuration file, I can confirm that:

  1. The new CPU usage metrics are properly enabled and there are no deprecated CPU utilization metrics enabled
  2. All required uptime metrics for nodes, pods, and containers are correctly configured
  3. The resource utilization metrics for container limits and requests are properly set up
  4. The metrics are configured under the correct section (presets.kubeletMetrics.metrics)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the deprecated metrics are not enabled alongside the new ones

# Test: Search for any deprecated CPU utilization metrics. Expect: No results
rg -l "k8s\.(pod|node|container)\.cpu\.utilization.*enabled:\s*true"

# Test: Verify all new metrics are properly configured. Expect: All metrics present
rg "k8s\.(node|pod|container)\.(cpu\.usage|uptime|cpu_limit_utilization|cpu_request_utilization|memory_limit_utilization|memory_request_utilization).*enabled:\s*true"

Length of output: 239


Script:

#!/bin/bash
# Let's try a different approach by checking the entire file content
# This will help us understand the metric configurations in their full context

# Show the complete metrics configuration section
cat charts/k8s-infra/values.yaml

Length of output: 28141

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
charts/k8s-infra/values.yaml (2)

234-241: LGTM: Resource utilization metrics enabled for capacity monitoring.

The addition of CPU and memory limit/request utilization metrics enables better resource monitoring and capacity planning.

Consider setting up alerts based on these metrics to proactively identify:

  • Containers approaching resource limits
  • Pods with significant disparity between requests and actual usage
  • Potential resource constraints that could affect application performance

Line range hint 18-18: Remove duplicate clusterName configuration.

The file contains two identical clusterName configurations:

  1. In the global section: global.clusterName
  2. At the root level: clusterName

This duplication could lead to confusion and potential misconfiguration.

Recommend keeping only the global configuration and removing the root-level one:

# Global override values
global:
  # -- Overrides the Docker registry globally for all images
  imageRegistry: null
  # -- Global Image Pull Secrets
  imagePullSecrets: []
  # -- Overrides the storage class for all PVC with persistence enabled.
  storageClass: null
  # -- Kubernetes cluster domain
  # It is used only when components are installed in different namespace
  clusterDomain: cluster.local
  # -- Kubernetes cluster name
  # It is used to attached to telemetry data via resource detection processor
  clusterName: ""
  # -- Deployment environment to be attached to telemetry data
  deploymentEnvironment: ""
  # -- Kubernetes cluster cloud provider along with distribution if any.
  # example: `aws`, `azure`, `gcp`, `gcp/autogke`, `azure`, and `other`
  cloud: other

# -- K8s infra chart name override
nameOverride: ""

# -- K8s infra chart full name override
fullnameOverride: ""

# -- Whether to enable K8s infra chart
enabled: true

- # -- Name of the K8s cluster. Used by OtelCollectors to attach in telemetry data.
- clusterName: ""

Also applies to: 37-37

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 450cbbc and e78e92e.

📒 Files selected for processing (1)
  • charts/k8s-infra/values.yaml (2 hunks)
🔇 Additional comments (2)
charts/k8s-infra/values.yaml (2)

216-217: LGTM: CPU usage metrics enabled appropriately.

The addition of CPU usage metrics (k8s.node.cpu.usage, k8s.pod.cpu.usage, container.cpu.usage) aligns with the deprecation of utilization metrics and ensures data continuity.

Also applies to: 220-221, 232-233


218-219: LGTM: Uptime metrics enabled for comprehensive monitoring.

The addition of uptime metrics at node, pod, and container levels enables better monitoring of component lifecycle and availability.

Also applies to: 230-231, 242-243

@srikanthccv srikanthccv merged commit 3aa9412 into main Nov 4, 2024
3 checks passed
@srikanthccv srikanthccv deleted the kubelet-addl-metrics branch November 4, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants