Skip to content

Commit

Permalink
chore: update API definitions for stop criteria, closes CLD-5906
Browse files Browse the repository at this point in the history
Modifications:
* Add stop criteria in simulation request and response
* Add stop criteria in run snapshot
  • Loading branch information
tpetillot committed Oct 18, 2024
1 parent 2860cf2 commit e9058b7
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
98 changes: 98 additions & 0 deletions openapi/src/main/openapi/common/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,104 @@ schemas:
example:
customProperty: "value"

StopCriteria:
type: array
description: An array of stop criteria that includes CPU, error ratio, and response time configurations.
This is particularly useful for terminating test runs once key performance metrics exceed acceptable limits.
items:
oneOf:
- $ref: '#/schemas/MeanCpuStopCriterion'
- $ref: '#/schemas/GlobalErrorRatioStopCriterion'
- $ref: '#/schemas/GlobalResponseTimeStopCriterion'

MeanCpuStopCriterion:
type: object
description: Stop criterion based on CPU usage
required:
- type
- threshold
- timeframeInSeconds
properties:
type:
type: string
enum:
- meanCpu
description: Type of the stop criterion.
threshold:
$ref: '#/schemas/MeanCpuThreshold'
timeframeInSeconds:
type: integer
description: Timeframe in seconds to measure the stop criterion.
example: 60

GlobalErrorRatioStopCriterion:
type: object
description: Stop criterion based on global error ratio
required:
- type
- threshold
- timeframeInSeconds
properties:
type:
type: string
enum:
- globalErrorRatio
description: Type of the stop criterion.
threshold:
$ref: '#/schemas/GlobalErrorRatioThreshold'
timeframeInSeconds:
type: integer
description: Timeframe in seconds to measure the stop criterion.
example: 60

GlobalResponseTimeStopCriterion:
type: object
description: Stop criterion based on global response time
required:
- type
- threshold
- timeframeInSeconds
properties:
type:
type: string
enum:
- globalResponseTime
description: Type of the stop criterion.
threshold:
$ref: '#/schemas/GlobalResponseTimeThreshold'
timeframeInSeconds:
type: integer
description: Timeframe in seconds to measure the stop criterion.
example: 100

MeanCpuThreshold:
type: object
properties:
maxPercentage:
type: number
description: The maximum allowed CPU percentage.
example: 90

GlobalErrorRatioThreshold:
type: object
properties:
maxPercentage:
type: number
description: The maximum allowed error ratio percentage.
example: 90

GlobalResponseTimeThreshold:
type: object
properties:
percentile:
type: number
description: The percentile for response time threshold.
example: 99.9
maxMilliseconds:
type: number
description: The maximum allowed response time in milliseconds.
example: 300

# Examples
examples:

Expand Down
2 changes: 2 additions & 0 deletions openapi/src/main/openapi/runs/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ schemas:
type: string
artifactId:
type: string
stopCriteria:
$ref: '../common/components.yaml#/schemas/StopCriteria'
comments:
type: object
properties:
Expand Down
6 changes: 6 additions & 0 deletions openapi/src/main/openapi/simulation/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ requests:
type: boolean
description: Use dedicated IPs for your load generators
example: false
stopCriteria:
$ref: '../common/components.yaml#/schemas/StopCriteria'

# TODO: all requests should be defined here

Expand Down Expand Up @@ -177,6 +179,8 @@ responses:
type: boolean
description: Use dedicated IPs for your load generators
example: false
stopCriteria:
$ref: '../common/components.yaml#/schemas/StopCriteria'

# TODO: all responses should be defined here

Expand Down Expand Up @@ -210,6 +214,8 @@ schemas:
description: Fully qualified class name of a simulation
example: computerdatabase.BasicSimulation

StopCriterion:
type: object

HostsByPool:
type: object
Expand Down

0 comments on commit e9058b7

Please sign in to comment.