Skip to content

Design doc updates for Pod Count#1923

Open
khansaad wants to merge 2 commits into
kruize:pod-count-fixfrom
khansaad:docs-update
Open

Design doc updates for Pod Count#1923
khansaad wants to merge 2 commits into
kruize:pod-count-fixfrom
khansaad:docs-update

Conversation

@khansaad

@khansaad khansaad commented May 22, 2026

Copy link
Copy Markdown
Contributor

Description

This PR contains docs changes for the Pod count feature.
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

How has this been tested?

Please describe the tests that were run to verify your changes and steps to reproduce. Please specify any test configuration required.

  • New Test X
  • Functional testsuite

Test Configuration

  • Kubernetes clusters tested on:

Checklist 🎯

  • Followed coding guidelines
  • Comments added
  • Dependent changes merged
  • Documentation updated
  • Tests added or updated

Additional information

Include any additional information such as links, test results, screenshots here

Summary by Sourcery

Documentation:

  • Add design documentation for the consolidated /kruize/api/v1/recommendations endpoint, including required query parameters, response structure with pod count metrics, and detailed error conditions.

Signed-off-by: Saad Khan <saakhan@ibm.com>
@khansaad khansaad added this to the Kruize 0.11.0 Release milestone May 22, 2026
@khansaad khansaad requested review from chandrams and mbvreddy May 22, 2026 12:00
@khansaad khansaad self-assigned this May 22, 2026
@khansaad khansaad added the documentation Improvements or additions to documentation label May 22, 2026
@sourcery-ai

sourcery-ai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds documentation for a new unified Recommendations API endpoint (used by the Pod count feature) to the MonitoringMode API design doc, including request parameters, example usage, a detailed sample response showing pod_count metrics and pods_count recommendations, and a table of possible error responses.

Sequence diagram for the unified Recommendations API endpoint

sequenceDiagram
  actor User
  participant RecommendationsAPI

  User->>RecommendationsAPI: POST /kruize/api/v1/recommendations
  alt [missing experiment_name]
    RecommendationsAPI-->>User: 400 experiment_name is mandatory
  else [remote mode without interval_end_time]
    RecommendationsAPI-->>User: 400 interval_end_time is mandatory
  else [invalid timestamp format]
    RecommendationsAPI-->>User: 400 Given timestamp is not a valid timestamp format
  else [no metrics or invalid interval]
    RecommendationsAPI-->>User: 400 No metrics or invalid interval
  else [valid request]
    RecommendationsAPI-->>User: 201 recommendations with pod_count and pods_count
  end
Loading

Flow diagram for Recommendations API request validation and pod count-based recommendations

flowchart TD
  Start([Start /kruize/api/v1/recommendations request])
  VExp{experiment_name provided?}
  VEndReq{Remote mode
requires interval_end_time?}
  VEndProvided{interval_end_time provided?}
  VFormat{Timestamps valid
and well formatted?}
  VOrder{interval_start_time
<= interval_end_time?}
  VRange{Range <= 15 days?}
  Success([Generate recommendations
with pod_count metrics
201 Created])

  Err400Exp([400 experiment_name is mandatory])
  Err400End([400 interval_end_time is mandatory])
  Err400Format([400 invalid timestamp format])
  Err400Order([400 The Start time should precede the End time])
  Err400Range([400 The gap must be within a maximum of 15 days])

  Start --> VExp
  VExp -->|No| Err400Exp
  VExp -->|Yes| VEndReq

  VEndReq -->|Local mode| VFormat
  VEndReq -->|Remote mode| VEndProvided

  VEndProvided -->|No| Err400End
  VEndProvided -->|Yes| VFormat

  VFormat -->|No| Err400Format
  VFormat -->|Yes| VOrder

  VOrder -->|No| Err400Order
  VOrder -->|Yes| VRange

  VRange -->|No| Err400Range
  VRange -->|Yes| Success
Loading

File-Level Changes

Change Details Files
Document a new unified Recommendations API endpoint that replaces existing recommendation APIs.
  • Extend the MonitoringMode API design doc TOC to include a Recommendations API section with subsections for introduction, examples, and invalid scenarios.
  • Describe the Recommendations API behavior, including required and optional parameters, local vs remote mode requirements, and constraints on interval duration.
  • Provide example POST requests (curl and endpoint variations) for generating recommendations based on interval_end_time and optional interval_start_time.
  • Add a detailed example JSON response illustrating pod_count metrics, pods_count fields in cost and performance engines, and term-based recommendations (short/medium/long term).
  • Document validation and error conditions in a table of HTTP status codes and messages for common request issues.
design/MonitoringModeAPI.md

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

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've found 5 issues, and left some high level feedback:

  • The timestamp format string is documented as yyyy-MM-ddTHH:mm:sssZ; consider clarifying or correcting this to the conventional yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (or similar) so users know exactly what format the API expects.
  • In the example response, metrics_info uses pod_count while the recommendation engines use pods_count; it would help to standardize this naming or explicitly call out the difference to avoid confusion for consumers.
  • The error responses table lists multiple 400 entries with similar phrasing (e.g., two mandatory-parameter rows and a trailing | on the last-but-one line); consolidating or tightening these entries would make the error semantics clearer and the table formatting more consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The timestamp format string is documented as `yyyy-MM-ddTHH:mm:sssZ`; consider clarifying or correcting this to the conventional `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'` (or similar) so users know exactly what format the API expects.
- In the example response, `metrics_info` uses `pod_count` while the recommendation engines use `pods_count`; it would help to standardize this naming or explicitly call out the difference to avoid confusion for consumers.
- The error responses table lists multiple 400 entries with similar phrasing (e.g., two mandatory-parameter rows and a trailing `|` on the last-but-one line); consolidating or tightening these entries would make the error semantics clearer and the table formatting more consistent.

## Individual Comments

### Comment 1
<location path="design/MonitoringModeAPI.md" line_range="6803" />
<code_context>

+### Recommendations API
+
+**Note: This API is common for both Local and Remote Monitoring use case.** <br>
+**Note: This API will replace the existing updateRecommendations and generateRecommendations API as a single endpoint** <br>
+Generates the recommendation for a specific experiment based on provided parameters similar to updateRecommendations and generateRecommendations API.
</code_context>
<issue_to_address>
**suggestion (typo):** Consider using the plural form "use cases" here.

Because this note covers both Local and Remote Monitoring, the plural "use cases" is grammatically correct here.

```suggestion
**Note: This API is common for both Local and Remote Monitoring use cases.** <br>
```
</issue_to_address>

### Comment 2
<location path="design/MonitoringModeAPI.md" line_range="6804-6805" />
<code_context>
+### Recommendations API
+
+**Note: This API is common for both Local and Remote Monitoring use case.** <br>
+**Note: This API will replace the existing updateRecommendations and generateRecommendations API as a single endpoint** <br>
+Generates the recommendation for a specific experiment based on provided parameters similar to updateRecommendations and generateRecommendations API.
+This can be called based on the mode which user selects in the config.
</code_context>
<issue_to_address>
**suggestion (typo):** Pluralize "API" at the end to match the two APIs being referenced.

Since this sentence refers to both `updateRecommendations` and `generateRecommendations`, the ending should use "APIs" (e.g., "generateRecommendations APIs") rather than the singular "API."

```suggestion
**Note: This API will replace the existing updateRecommendations and generateRecommendations APIs as a single endpoint** <br>
Generates the recommendation for a specific experiment based on provided parameters similar to updateRecommendations and generateRecommendations APIs.
```
</issue_to_address>

### Comment 3
<location path="design/MonitoringModeAPI.md" line_range="6805-6806" />
<code_context>
+
+**Note: This API is common for both Local and Remote Monitoring use case.** <br>
+**Note: This API will replace the existing updateRecommendations and generateRecommendations API as a single endpoint** <br>
+Generates the recommendation for a specific experiment based on provided parameters similar to updateRecommendations and generateRecommendations API.
+This can be called based on the mode which user selects in the config.
+
+**Request Parameters**
</code_context>
<issue_to_address>
**suggestion (typo):** Improve grammar by adding a subject, pluralizing "recommendation", and adding "the" before "user".

For example, you could rewrite them as: "This API generates recommendations for a specific experiment based on the provided parameters, similar to the `updateRecommendations` and `generateRecommendations` APIs. It can be called based on the mode that the user selects in the config."

```suggestion
This API generates recommendations for a specific experiment based on the provided parameters, similar to the `updateRecommendations` and `generateRecommendations` APIs.
It can be called based on the mode that the user selects in the config.
```
</issue_to_address>

### Comment 4
<location path="design/MonitoringModeAPI.md" line_range="6816" />
<code_context>
+| interval_end_time   | string | mandatory/optional | The end time of the interval in the format `yyyy-MM-ddTHH:mm:sssZ`. This should be the date on which recommendation needs to be generated. **Mandatory for remote mode** |
+| interval_start_time | string | optional           | The start time of the interval in the format `yyyy-MM-ddTHH:mm:sssZ`.                                                                                                    |
+
+The recommendation API requires only one mandatory field i.e. `experiment_name` in case of local mode and both `experiment_name` and `interval_end_time` in case of remote.
+Similarly, `interval_start_time` will be calculated based on `interval_end_time`, if not provided. By utilizing
+these parameters, the API generates recommendations based on short-term, medium-term, and long-term factors. For
</code_context>
<issue_to_address>
**nitpick (typo):** Tighten the grammar around "i.e." and clarify the modes.

Consider adding commas around “i.e.” and smoothing the sentence, for example: “The recommendation API requires only one mandatory field, i.e., `experiment_name`, in local mode, and both `experiment_name` and `interval_end_time` in remote mode.”

```suggestion
The recommendation API requires only one mandatory field, i.e., `experiment_name`, in local mode, and both `experiment_name` and `interval_end_time` in remote mode.
```
</issue_to_address>

### Comment 5
<location path="design/MonitoringModeAPI.md" line_range="6841" />
<code_context>
+
+**Response**
+
+The response will contain a array of JSON object with the recommendations for the specified experiment.
+
+<details>
</code_context>
<issue_to_address>
**issue (typo):** Fix article and pluralization in this sentence.

Please change this to: "an array of JSON objects."

```suggestion
The response will contain an array of JSON objects with the recommendations for the specified experiment.
```
</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.

Comment thread design/MonitoringModeAPI.md Outdated
Comment thread design/MonitoringModeAPI.md Outdated
Comment thread design/MonitoringModeAPI.md Outdated
Comment thread design/MonitoringModeAPI.md Outdated
Comment thread design/MonitoringModeAPI.md Outdated
Signed-off-by: Saad Khan <saakhan@ibm.com>
@rbadagandi1 rbadagandi1 moved this to In Progress in Monitoring May 25, 2026

@chandrams chandrams left a comment

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.

LGTM

@rbadagandi1 rbadagandi1 moved this from In Progress to Ready for merge in Monitoring Jun 8, 2026
@mbvreddy mbvreddy removed this from Monitoring Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants