Skip to content

Commit

Permalink
Merge pull request #21 from MZC-CSC/develop
Browse files Browse the repository at this point in the history
update performance evaluation apis
  • Loading branch information
MZC-CSC authored Nov 14, 2024
2 parents 89495ea + 5a1928c commit 2951be7
Show file tree
Hide file tree
Showing 33 changed files with 1,391 additions and 589 deletions.
334 changes: 249 additions & 85 deletions api/docs.go

Large diffs are not rendered by default.

334 changes: 249 additions & 85 deletions api/swagger.json

Large diffs are not rendered by default.

249 changes: 179 additions & 70 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ definitions:
- OnFetching
- Successed
- TestFailed
constant.IconCode:
enum:
- IC0001
- IC0002
- IC0003
type: string
x-enum-varnames:
- Ok
- Fail
- Pending
constant.InstallLocation:
enum:
- local
Expand Down Expand Up @@ -713,10 +723,14 @@ definitions:
type: string
executionStatus:
$ref: '#/definitions/constant.ExecutionStatus'
expectedFinishAt:
type: string
failureMessage:
type: string
finishAt:
type: string
iconCode:
$ref: '#/definitions/constant.IconCode'
id:
type: integer
loadGeneratorInstallInfo:
Expand Down Expand Up @@ -1195,38 +1209,7 @@ paths:
summary: Uninstall Load Generator
tags:
- '[Load Generator Management]'
/api/v1/load/monitoring/agent/install:
post:
consumes:
- application/json
description: Install a monitoring agent on specific mci.
operationId: InstallMonitoringAgent
parameters:
- description: Monitoring Agent Installation Request
in: body
name: body
required: true
schema:
$ref: '#/definitions/app.MonitoringAgentInstallationReq'
produces:
- application/json
responses:
"200":
description: Successfully installed monitoring agent
schema:
$ref: '#/definitions/app.AntResponse-load_MonitoringAgentInstallationResult'
"400":
description: Monitoring agent installation info is not correct.
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Install Metrics Monitoring Agent
tags:
- '[Monitoring Agent Management]'
/api/v1/load/monitoring/agents:
/api/v1/load/monitoring/agent:
get:
consumes:
- application/json
Expand Down Expand Up @@ -1271,7 +1254,38 @@ paths:
summary: Retrieve Monitoring Agent Information
tags:
- '[Monitoring Agent Management]'
/api/v1/load/monitoring/agents/uninstall:
/api/v1/load/monitoring/agent/install:
post:
consumes:
- application/json
description: Install a monitoring agent on specific mci.
operationId: InstallMonitoringAgent
parameters:
- description: Monitoring Agent Installation Request
in: body
name: body
required: true
schema:
$ref: '#/definitions/app.MonitoringAgentInstallationReq'
produces:
- application/json
responses:
"200":
description: Successfully installed monitoring agent
schema:
$ref: '#/definitions/app.AntResponse-load_MonitoringAgentInstallationResult'
"400":
description: Monitoring agent installation info is not correct.
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Install Metrics Monitoring Agent
tags:
- '[Monitoring Agent Management]'
/api/v1/load/monitoring/agent/uninstall:
post:
consumes:
- application/json
Expand Down Expand Up @@ -1303,37 +1317,72 @@ paths:
summary: Uninstall Monitoring Agents
tags:
- '[Monitoring Agent Management]'
/api/v1/load/test/metrics:
/api/v1/load/tests/infos:
get:
consumes:
- application/json
description: Retrieve load test metrics based on provided parameters.
operationId: GetLoadTestMetrics
description: Retrieve a list of all load test execution information with pagination
support.
operationId: GetAllLoadTestExecutionInfos
parameters:
- description: Load test key
- description: Page number for pagination (default 1)
in: query
name: page
type: integer
- description: Number of items per page (default 10, max 10)
in: query
name: size
type: integer
produces:
- application/json
responses:
"200":
description: Successfully retrieved load test execution information
schema:
$ref: '#/definitions/app.AntResponse-load_GetAllLoadTestExecutionInfosResult'
"400":
description: Invalid request parameters
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Failed to retrieve all load test execution information
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Get All Load Test Execution Information
tags:
- '[Load Test Execution Management]'
/api/v1/load/tests/infos/{loadTestKey}:
get:
consumes:
- application/json
description: Retrieve the load test execution state information for a specific
load test key.
operationId: GetLoadTestExecutionInfo
parameters:
- description: Load test key
in: path
name: loadTestKey
required: true
type: string
produces:
- application/json
responses:
"200":
description: Successfully retrieved load test metrics
description: Successfully retrieved load test execution state information
schema:
$ref: '#/definitions/app.AntResponse-array_load_MetricsSummary'
$ref: '#/definitions/app.AntResponse-load_LoadTestExecutionInfoResult'
"400":
description: Invalid request parameters
description: Load test key must be set.
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Failed to retrieve load test metrics
description: Failed to retrieve load test execution state information
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Get load test metrics
summary: Get Load Test Execution State
tags:
- '[Load Test Result]'
/api/v1/load/test/result:
- '[Load Test Execution Management]'
/api/v1/load/tests/result:
get:
consumes:
- application/json
Expand Down Expand Up @@ -1374,71 +1423,131 @@ paths:
summary: Get load test result
tags:
- '[Load Test Result]'
/api/v1/load/tests/infos:
/api/v1/load/tests/result/last:
get:
consumes:
- application/json
description: Retrieve a list of all load test execution information with pagination
support.
operationId: GetAllLoadTestExecutionInfos
description: Retrieve last load test result based on provided parameters.
operationId: GetLastLoadTestResult
parameters:
- description: Page number for pagination (default 1)
- description: ns id
in: query
name: page
type: integer
- description: Number of items per page (default 10, max 10)
name: nsId
required: true
type: string
- description: mci id
in: query
name: size
type: integer
name: mciId
required: true
type: string
- description: vm id
in: query
name: vmId
required: true
type: string
- description: Result format (normal or aggregate)
in: query
name: format
type: string
produces:
- application/json
responses:
"200":
description: Successfully retrieved load test execution information
description: Successfully retrieved load test metrics
schema:
$ref: '#/definitions/app.AntResponse-load_GetAllLoadTestExecutionInfosResult'
allOf:
- $ref: '#/definitions/app.JsonResult'
- properties:
'[aggregate]':
$ref: '#/definitions/app.AntResponse-array_load_LoadTestStatistics'
'[normal]':
$ref: '#/definitions/app.AntResponse-array_load_ResultSummary'
type: object
"400":
description: Invalid request parameters
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Failed to retrieve all load test execution information
description: Failed to retrieve load test result
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Get All Load Test Execution Information
summary: Get last load test result by ns, mci, vm
tags:
- '[Load Test Execution Management]'
/api/v1/load/tests/infos/{loadTestKey}:
- '[Load Test Result]'
/api/v1/load/tests/result/metrics:
get:
consumes:
- application/json
description: Retrieve the load test execution state information for a specific
load test key.
operationId: GetLoadTestExecutionInfo
description: Retrieve load test metrics based on provided parameters.
operationId: GetLoadTestMetrics
parameters:
- description: Load test key
in: path
in: query
name: loadTestKey
required: true
type: string
produces:
- application/json
responses:
"200":
description: Successfully retrieved load test execution state information
description: Successfully retrieved load test metrics
schema:
$ref: '#/definitions/app.AntResponse-load_LoadTestExecutionInfoResult'
$ref: '#/definitions/app.AntResponse-array_load_MetricsSummary'
"400":
description: Load test key must be set.
description: Invalid request parameters
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Failed to retrieve load test execution state information
description: Failed to retrieve load test metrics
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Get Load Test Execution State
summary: Get load test metrics
tags:
- '[Load Test Execution Management]'
- '[Load Test Result]'
/api/v1/load/tests/result/metrics/last:
get:
consumes:
- application/json
description: Retrieve last load test metrics based on provided parameters.
operationId: GetLastLoadTestMetrics
parameters:
- description: ns id
in: query
name: nsId
required: true
type: string
- description: mci id
in: query
name: mciId
required: true
type: string
- description: vm id
in: query
name: vmId
required: true
type: string
- description: Result format (normal for the moment)
in: query
name: format
type: string
produces:
- application/json
responses:
"200":
description: Successfully retrieved load test metrics
schema:
$ref: '#/definitions/app.AntResponse-array_load_MetricsSummary'
"400":
description: Invalid request parameters
schema:
$ref: '#/definitions/app.AntResponse-string'
"500":
description: Failed to retrieve load test metrics
schema:
$ref: '#/definitions/app.AntResponse-string'
summary: Get last load test metrics by ns, mci, vm
tags:
- '[Load Test Result]'
/api/v1/load/tests/run:
post:
consumes:
Expand Down
6 changes: 3 additions & 3 deletions internal/app/estimate_cost_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/cloud-barista/cm-ant/internal/config"
"github.com/cloud-barista/cm-ant/internal/core/common/constant"
"github.com/cloud-barista/cm-ant/internal/core/cost"
"github.com/cloud-barista/cm-ant/internal/utils"
"github.com/labstack/echo/v4"
"github.com/rs/zerolog/log"
)

// @Id UpdateAndGetEstimateCost
Expand Down Expand Up @@ -74,12 +74,12 @@ func (a *AntServer) updateAndGetEstimateCost(c echo.Context) error {
splitedCommonImage := strings.Split(ci, delim)

if len(splitedCommonSpec) != 3 {
utils.LogErrorf("common spec format is not correct; image: %s; spec: %s", ci, cs)
log.Error().Msgf("common spec format is not correct; image: %s; spec: %s", ci, cs)
return errorResponseJson(http.StatusBadRequest, fmt.Sprintf("common spec format is not correct; image: %s; spec: %s", ci, cs))
}

if len(splitedCommonImage) == 3 && (splitedCommonImage[0] != splitedCommonSpec[0] || splitedCommonImage[1] != splitedCommonSpec[1]) {
utils.LogErrorf("common image and spec recommendation is wrong; image: %s; spec: %s", ci, cs)
log.Error().Msgf("common image and spec recommendation is wrong; image: %s; spec: %s", ci, cs)
return errorResponseJson(http.StatusBadRequest, fmt.Sprintf("common image and spec recommendation is wrong; image: %s; spec: %s", ci, cs))
}

Expand Down
Loading

0 comments on commit 2951be7

Please sign in to comment.