Skip to content

Commit

Permalink
Added updateRecommendation API details into md file.
Browse files Browse the repository at this point in the history
Signed-off-by: msvinaykumar <vinakuma@redhat.com>
  • Loading branch information
msvinaykumar committed May 23, 2023
1 parent 89e1837 commit 2988997
Showing 1 changed file with 58 additions and 4 deletions.
62 changes: 58 additions & 4 deletions design/MonitoringModeAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ see [Update results](/design/UpdateResults.md)

**NOTE:** The update to results of a particular experiment should follow Time Series Order to get valid recommendations.

**Eg:** after updating the results for time stamp `2022-01-23T18:25:43.511Z` you cannot add results previous to that timestamp

**Eg:** after updating the results for time stamp `2022-01-23T18:25:43.511Z` you cannot add results previous to that
timestamp

* Mandatory parameters in the input JSON:

```
cpuUsage, memoryUsage, memoryRSS
```
* Note: If the parameters `cpuRequest`, `cpuLimit`, `memoryRequest` and `memoryLimit` are missing, then they are assumed to not have been set for the container in question.

* Note: If the parameters `cpuRequest`, `cpuLimit`, `memoryRequest` and `memoryLimit` are missing, then they are assumed
to not have been set for the container in question.

**Request**
`POST /updateResults`
Expand Down Expand Up @@ -330,6 +333,50 @@ see [Update results](/design/UpdateResults.md)
}
```

## Update Recommendations

This API is used to update recommendations for a specific experiment for given interval_end_time.

**Request**

```
POST /updateRecommendations
curl --request POST '/updateRecommendations?interval_end_time=2023-01-02TT00:15:00.000Z&experiment_name=temp2_1'
```

**Request Parameters**

The following parameters are required in the request body:

```
experiment_name (string): The name of the experiment.
intervalEndTime (string): The end time of the interval in the
format "yyyy-MM-ddTHH:mm:sssZ".
```

**Response**

The response will be in JSON format.

Success Response:

```
Status Code: 201
Response Body: "Recommendation generated successfully! Visit /listRecommendations"
```

Error Responses:

```
Status Code: 400
Response Body: Error message indicating the missing or invalid request parameters.
Status Code: 500
Response Body: Error message indicating an internal server error.
```

## Recommendations

List recommendations output JSON as follows. Some parameters like CPU limit , ENV are optional.
Expand All @@ -353,6 +400,7 @@ List recommendations output JSON as follows. Some parameters like CPU limit , EN
If no parameter is passed API returns all the latest recommendations available for each experiment.

**Response**

```
[
{
Expand Down Expand Up @@ -502,6 +550,7 @@ If no parameter is passed API returns all the latest recommendations available f
Returns the latest result of that experiment

**Response for experiment name - `quarkus-resteasy-kruize-min-http-response-time-db_0`**

```
[
{
Expand Down Expand Up @@ -774,7 +823,9 @@ Returns all the results of that experiment

Returns the recommendation at a particular timestamp if it exists

**Response for experiment name - `quarkus-resteasy-kruize-min-http-response-time-db_0` and Monitoring End Time - `2022-12-20T17:55:05.000Z`**
**Response for experiment name - `quarkus-resteasy-kruize-min-http-response-time-db_0` and Monitoring End Time

- `2022-12-20T17:55:05.000Z`**

```
[
Expand Down Expand Up @@ -868,6 +919,7 @@ Returns the recommendation at a particular timestamp if it exists
**Invalid experiment name**

`experiment_name=stub-experiment`

```
{
"message": "Given experiment name - \" stub-experiment \" is not valid",
Expand All @@ -880,6 +932,7 @@ Returns the recommendation at a particular timestamp if it exists
**Invalid Timestamp format**

`monitoring_end_time=Tony Stark` (Invalid Timestamp)

```
{
"message": "Given timestamp - \" Tony Stark \" is not a valid timestamp format",
Expand All @@ -892,6 +945,7 @@ Returns the recommendation at a particular timestamp if it exists
**Non Existing Timestamp**

`monitoring_end_time=2022-12-20T17:55:07.000Z`

```
{
"message": "Recommendation for timestamp - \" 2022-12-20T17:55:07.000Z \" does not exist",
Expand Down

0 comments on commit 2988997

Please sign in to comment.