Skip to content

Include min cpu throttle query in performance profile used in remote monitoring mode.#1889

Open
kusumachalasani wants to merge 1 commit into
kruize:mvp_demofrom
kusumachalasani:throttle_ros
Open

Include min cpu throttle query in performance profile used in remote monitoring mode.#1889
kusumachalasani wants to merge 1 commit into
kruize:mvp_demofrom
kusumachalasani:throttle_ros

Conversation

@kusumachalasani
Copy link
Copy Markdown
Contributor

@kusumachalasani kusumachalasani commented Apr 24, 2026

Description

Include min cpu throttle query in performance profile used in remote monitoring mode which is missing.

Fixes # (issue)

Type of change

  • Bug fix
  • New feature
  • Docs update
  • Breaking change (What changes might users need to make in their application due to this PR?)
  • Requires DB changes
  • [ X] Manifests fix

Summary by Sourcery

Enhancements:

  • Add a minimum CPU throttling query alongside existing average and maximum throttling metrics in the OpenShift resource optimization performance profile manifests.

Signed-off-by: kusuma chalasani <kchalasa@redhat.com>
@kusumachalasani kusumachalasani self-assigned this Apr 24, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a minimum CPU throttling Prometheus query to the OpenShift resource optimization performance profile used for remote monitoring, complementing the existing average and maximum throttling metrics.

Sequence diagram for remote monitoring using min/avg/max CPU throttling metrics

sequenceDiagram
    participant RemoteMonitoringController
    participant PerformanceProfile_resource_optimization_openshift
    participant Prometheus

    RemoteMonitoringController->>PerformanceProfile_resource_optimization_openshift: Load SLO CPU throttling queries
    PerformanceProfile_resource_optimization_openshift-->>RemoteMonitoringController: avg, min, max throttling query templates

    loop Each monitored container
        RemoteMonitoringController->>Prometheus: Execute avg throttling query
        Prometheus-->>RemoteMonitoringController: avg rate(container_cpu_cfs_throttled_seconds_total)

        RemoteMonitoringController->>Prometheus: Execute min throttling query
        Prometheus-->>RemoteMonitoringController: min rate(container_cpu_cfs_throttled_seconds_total)

        RemoteMonitoringController->>Prometheus: Execute max throttling query
        Prometheus-->>RemoteMonitoringController: max rate(container_cpu_cfs_throttled_seconds_total)

        RemoteMonitoringController->>RemoteMonitoringController: Evaluate SLOs using avg, min, max
    end
Loading

File-Level Changes

Change Details Files
Add a Prometheus query for minimum CPU throttling per container to the OpenShift resource optimization performance profile to mirror the existing avg/max queries.
  • Introduce a new SLO entry with function min over container_cpu_cfs_throttled_seconds_total grouped by container and namespace.
  • Reuse the same label filters and 15m rate window as the existing avg/max throttling queries to keep metric semantics consistent.
  • Mirror this new min CPU throttle query in both the YAML and JSON variants of the performance profile so they stay in sync.
manifests/autotune/performance-profiles/resource_optimization_openshift.yaml
manifests/autotune/performance-profiles/resource_optimization_openshift.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new min query (and the existing avg/max ones) use curly quotes around $CONTAINER_NAME$; these should be plain ASCII double quotes so the PromQL selector parses correctly.
  • Since the min/avg/max CPU throttling queries are identical except for the aggregation function, consider extracting the common selector into a shared template or variable (if your manifest tooling allows) to avoid duplication and reduce the chance of future inconsistencies.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `min` query (and the existing `avg`/`max` ones) use curly quotes around `$CONTAINER_NAME$`; these should be plain ASCII double quotes so the PromQL selector parses correctly.
- Since the min/avg/max CPU throttling queries are identical except for the aggregation function, consider extracting the common selector into a shared template or variable (if your manifest tooling allows) to avoid duplication and reduce the chance of future inconsistencies.

## Individual Comments

### Comment 1
<location path="manifests/autotune/performance-profiles/resource_optimization_openshift.yaml" line_range="123" />
<code_context>

+    # Minimum CPU throttling per container in a deployment
+    - function: min
+      query: 'min by(container, namespace)(rate(container_cpu_cfs_throttled_seconds_total{container!="", container!="POD", pod!="", namespace="$NAMESPACE$", container=”$CONTAINER_NAME$”}[15m]))'
+
     # Maximum CPU throttling per container in a deployment
</code_context>
<issue_to_address>
**issue (bug_risk):** The query uses a Unicode smart quote around $CONTAINER_NAME$, which will break PromQL parsing.

The `container=”$CONTAINER_NAME$”` segment uses a Unicode smart quote (``) instead of a standard ASCII double quote (`"`), which Prometheus can’t parse. Please change it to `container="$CONTAINER_NAME$"` so the query parses correctly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


# Minimum CPU throttling per container in a deployment
- function: min
query: 'min by(container, namespace)(rate(container_cpu_cfs_throttled_seconds_total{container!="", container!="POD", pod!="", namespace="$NAMESPACE$", container=”$CONTAINER_NAME$”}[15m]))'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The query uses a Unicode smart quote around $CONTAINER_NAME$, which will break PromQL parsing.

The container=”$CONTAINER_NAME$” segment uses a Unicode smart quote () instead of a standard ASCII double quote ("), which Prometheus can’t parse. Please change it to container="$CONTAINER_NAME$" so the query parses correctly.

@kusumachalasani kusumachalasani added this to the Kruize 0.11.0 Release milestone Apr 24, 2026
@rbadagandi1 rbadagandi1 moved this to In Progress in Monitoring May 11, 2026
@rbadagandi1 rbadagandi1 moved this from In Progress to Under Review in Monitoring May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Under Review

Development

Successfully merging this pull request may close these issues.

2 participants